public void CollectionPropertyTest() { ShippingList actual = new ShippingList(); actual.Products.Add(new Product("Ratched and Clank - Tools of Destruction", 61.05)); actual.Products.Add(new Product("Assassin's Creed", 69.99)); ShippingList expected = new ShippingList(); expected.Products.Add(new Product("Ratched and Clank - Tools of Destruction", 61.05)); expected.Products.Add(new Product("Uncharted - Drake's Fortune", 69.99)); AbstractConstraint sut = Property.AllPropertiesMatch(expected); Assert.False(sut.Eval(actual)); Assert.Equal("Expected value of ShippingList.Products[1].Name is 'Uncharted - Drake's Fortune', actual value is 'Assassin's Creed'", sut.Message); }
public void PublicFieldTest() { ShippingList actual = new ShippingList(); actual._shippingDate = new DateTime(2007, 9, 27); ShippingList expected = new ShippingList(); expected._shippingDate = new DateTime(1978, 9, 27); AbstractConstraint sut = Property.AllPropertiesMatch(expected); Assert.False(sut.Eval(actual)); Assert.Equal("Expected value of ShippingList._shippingDate is '09/27/1978 00:00:00', actual value is '09/27/2007 00:00:00'", sut.Message); }
public void CollectionPropertyCountTest() { ShippingList actual = new ShippingList(); actual.Products.Add(new Product("Ratched and Clank - Tools of Destruction", 61.05)); ShippingList expected = new ShippingList(); expected.Products.Add(new Product("Ratched and Clank - Tools of Destruction", 61.05)); expected.Products.Add(new Product("Uncharted - Drake's Fortune", 69.99)); AbstractConstraint sut = Property.AllPropertiesMatch(expected); Assert.False(sut.Eval(actual)); Assert.Equal("expected number of items in collection ShippingList.Products is '2', actual is '1'", sut.Message); }