How to create tests for poco objects

Posted by Simon G on Stack Overflow See other posts from Stack Overflow or by Simon G
Published on 2010-04-15T13:41:01Z Indexed on 2010/04/15 13:43 UTC
Read the original article Hit count: 303

Filed under:
|
|
|
|

Hi,

I'm new to mocking/testing and wanting to know what level should you go to when testing. For example in my code I have the following object:

public class RuleViolation
{
    public string ErrorMessage { get; private set; }
    public string PropertyName { get; private set; }

    public RuleViolation( string errorMessage )
    {
        ErrorMessage = errorMessage;
    }

    public RuleViolation( string errorMessage, string propertyName )
    {
        ErrorMessage = errorMessage;
        PropertyName = propertyName;
    }
}

This is a relatively simple object. So my question is:

Does it need a unit test?

If it does what do I test and how?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about unit-testing