示例#1
0
        public void Should_Add_Product()
        {
            //Arrange
            var sut = new NorthwindManager();
            var product = new Product()
            {
                ProductName = "MSP Basic Product",
                Discontinued = false
            };

            //Act

            var productID = sut.AddProduct(product);
            //Assert
            Assert.True(productID > 0);
            Product actual = sut.GetProduct(productID);
            Assert.Equal(productID, actual.ProductID);
        }
示例#2
0
        public void Should_Update_Products(Product existing)
        {
            //Arrange
            existing.ProductName = "TIN'S OLD PRODUCT";
            var sut = new NorthwindManager();

            //Act
            sut.UpdateProduct(existing);

            //Assert
            var actual = sut.GetProduct(existing.ProductID);
            Assert.NotNull(actual);
            Assert.Equal(existing.ProductName, actual.ProductName);
        }
示例#3
0
        public void Should_Delete_Products()
        {
            //Arrange
            var sut = new NorthwindManager();
            var actual = new Product()
            {
                ProductName = "Product to delete"
            };
            actual.ProductID = sut.AddProduct(actual);

            //Act
            sut.DeleteProduct(actual);
            //Assert
            Product p = sut.GetProduct(actual.ProductID);

            Assert.Null(p);
        }