Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create tests for poco objects

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

like image 981
lancscoder Avatar asked Apr 15 '10 13:04

lancscoder


1 Answers

it doesn't contain any logic => nothing to test

like image 125
Andrey Avatar answered Sep 19 '22 11:09

Andrey