Is there value in unit testing auto implemented properties
Posted
by ahsteele
on Stack Overflow
See other posts from Stack Overflow
or by ahsteele
Published on 2010-06-17T21:07:57Z
Indexed on
2010/06/17
21:13 UTC
Read the original article
Hit count: 262
It seems exceptionally heavy handed but going by the rule anything publicly available should be tested should auto-implemented properties be tested?
Customer Class
public class Customer
{
public string EmailAddr { get; set; }
}
Tested by
[TestClass]
public class CustomerTests : TestClassBase
{
[TestMethod]
public void CanSetCustomerEmailAddress()
{
//Arrange
Customer customer = new Customer();
//Act
customer.EmailAddr = "[email protected]";
//Assert
Assert.AreEqual("[email protected]", customer.EmailAddr);
}
}
© Stack Overflow or respective owner