Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void Should_Delete_Product()
        {
            //Arrange
            var sut = new NorthwindManager();  //sut is short for 'Scenario Under Test'
            var expected = new Product()
            {
                ProductName = "Double Double",
                UnitsInStock = 777
            };

            expected.ProductID = sut.AddProduct(expected);

            //Act
            sut.DeleteProduct(expected);

            //Assert
            Shipper actual = sut.GetShipper(expected.ProductID);
            Assert.Null(actual);
        }