谁能帮我这个?
[TestMethod]
public void MakeDateConstructsADateTimeFromYearMonthAndDay()
{
Arrange
var controller = new DateController();
var expected = new DateTime(2014, 6, 30);
Act
var result = controller.MakeDate(2014, 6, 30);
Assert
Assert.AreEqual<DateTime>(expected, result);
}
[TestMethod]
public void MakeDateReturnsDefaultDateTimeIfInputDataInvalid()
{
/* HINT You need to use a try ... catch block in the MakeDate()
* method to trap the exception thrown by the DateTime constructor.
* See http://msdn.microsoft.com/en-us/library/xcfzdy4x(v=vs.110)/
* for information on the exceptions thrown by the DateTime
* constructor.
* See http://msdn.microsoft.com/en-us/library/ms173160(v=vs.110).aspx
* for information on exception handling in C#.
* */
//Arrange
var controller = new DateController();//error
var expected = new DateTime();//error
//Act
//June has only 30 days so this will cause an exception
var result = controller.MakeDate(2014, 6, 31);
//Assert
Assert.AreEqual<DateTime>(expected, result);
}
不断收到错误说明 Error Expected class, delegate, enum, interface, or struct //getting errors under 'void, datacontroller and datetime