Модульное тестирование свойств C #

I am working with a class that has lots of properties. For example;

public class Bib
{        
    public int PartQty { get; set; }
}

Now to unit test; I did the xUnit test something like

    [Fact]
    public void CanGetAndSetPartQuantity()
    {
        const int expected = 3;

        var target = new Bib() {PartQty = expected};

        Assert.Equal(expected, target.PartQty);
    }

here, I hate how I am hard-coding expected = 3. What's a good way to test this property for accessor and mutator?

9
задан John Saunders 3 May 2011 в 23:38
поделиться