这似乎异常繁重,但按照规则,如果测试自动实现的属性,应该测试任何公开可用的东西吗?
客户类
public class Customer
{
public string EmailAddr { get; set; }
}
测试者
[TestClass]
public class CustomerTests : TestClassBase
{
[TestMethod]
public void CanSetCustomerEmailAddress()
{
//Arrange
Customer customer = new Customer();
//Act
customer.EmailAddr = "foo@bar.com";
//Assert
Assert.AreEqual("foo@bar.com", customer.EmailAddr);
}
}