public void Should_Add_Product() { //Arrange var sut = new NorthwindManager(); //sut is short for 'Scenario Under Test' var expected = new Product() { ProductName = "Double Double", UnitsInStock = 777 }; //Act var actualId = sut.AddProduct(expected); //Assert Assert.True(actualId > 0); Product actual = sut.GetProduct(actualId); Assert.Equal(expected.ProductName, actual.ProductName); Assert.Equal(expected.UnitsInStock, actual.UnitsInStock); Assert.Equal(actualId, actual.ProductID); }
public void Should_Update_Product(Product existing) { //Arrange existing.UnitsInStock = 777; var sut = new NorthwindManager(); //sut is short for 'Scenario Under Test' existing.UnitsInStock = 999; //Act sut.UpdateProduct(existing); //Assert var actual = sut.GetProduct(existing.ProductID); Assert.NotNull(actual); Assert.Equal(existing.ProductName, actual.ProductName); Assert.Equal(existing.UnitsInStock, actual.UnitsInStock); }