Is it necessary to unit test a value object, and how would you go about it?
Take for instance this object:
public class TeamProfile
{
public string Name { get; set; }
public int Wins { get; set; }
public int Losses { get; set; }
public int Draws { get; set; }
}
There is an excellent article on Value Objects and their introduction and testing by Dan Bergh Johnsson http://www.infoq.com/presentations/Value-Objects-Dan-Bergh-Johnsson
For clarity I must reiterate that the example given is not a value object. http://martinfowler.com/bliki/ValueObject.html
It is specifically either a command, message or more likely a (DTO) Data Transfer Object As others have mentioned, the provided class has no behaviour to test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With