Exemplo n.º 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);
        }
Exemplo n.º 2
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
        }