示例#1
0
        public void TheTheProductIsNoLongerAvailable()
        {
            //Arrange
            var checkOutSystem = new CheckOutSystem();
            var listOfProduct  = new List <Product> {
                new Product {
                    Name = "SweetCorn", Type = "Starter"
                }
            };                                                                                              //Add a new product
            var listOfProductToRemove = new List <Product> {
                new Product {
                    Name = "SweetCorn", Type = "Starter"
                }
            };                                                                                                      //Add a new product

            checkOutSystem.AddItems(listOfProduct);

            //Action
            checkOutSystem.RemoveItems(listOfProductToRemove);
            var listOfItems = new List <Item> {
                new Item("SweetCorn")
            };
            var actualResult = checkOutSystem.CheckOut(listOfItems); // Try to checkout deleted product

            //Assert
            Assert.AreEqual(0.00m, actualResult);
        }
        public void ThenTheTotalCostIsTheCostOfThoseTwoItems(List <Item> listOfItems, decimal expectedResult)
        {
            var checkOutSystem = new CheckOutSystem();

            //Action
            var actualResult = checkOutSystem.CheckOut(listOfItems);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
        public void ThenTheTotalCostIsZero()
        {
            //Arrange
            var           checkOutSystem = new CheckOutSystem();
            const decimal expectedResult = 0.00m;
            var           listOfItems    = new List <Item>();

            //Action
            var actualResult = checkOutSystem.CheckOut(listOfItems);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
示例#4
0
        public void ThenTheTotalCostIsTheCostOfNewItem()
        {
            var existingProduct = new Product {
                Name = "ChickenSoup", Type = "Starter"
            };
            var newProduct = new Product {
                Name = "MiniPizza", Type = "Starter"
            };
            var checkOutSystem = new CheckOutSystem();
            var expectedResult = 4.40m;

            //Action
            checkOutSystem.UpdateItem(existingProduct, newProduct);
            var listOfItems = new List <Item> {
                new Item("MiniPizza")
            };
            var actualResult = checkOutSystem.CheckOut(listOfItems);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
示例#5
0
        public void ThenTheTotalCostIsTheCostOfNewItem()
        {
            //Arrange
            var listOfProduct = new List <Product> {
                new Product {
                    Name = "ChickenSoup", Type = "Starter"
                }
            };
            var checkOutSystem = new CheckOutSystem();
            var expectedResult = 4.40M;

            //Action
            checkOutSystem.AddItems(listOfProduct);
            var listOfItems = new List <Item> {
                new Item("ChickenSoup")
            };
            var actualResult = checkOutSystem.CheckOut(listOfItems);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
            checkOutSystem.RemoveItems(listOfProduct); //Clean up
        }