예제 #1
0
        public void Constructor_Create_NotEmpty()
        {
            //Arrange
            Vending myVendor = new Vending();   // vending machine is now populated with standard products
            //Act
            List <Product> collection = myVendor.GetProducts();

            //Assert
            Assert.NotEmpty(collection);
        }
예제 #2
0
        public void GetId_CreateVendorPickDrinkOut_CheckedIdIs2()
        {
            //Arrange
            Vending        myVendor   = new Vending();
            List <Product> collection = myVendor.GetProducts();
            Product        myProduct  = collection[2];
            int            expectedId = 2;
            //Act
            int myProductId = myProduct.GetId();

            //Assert
            Assert.Equal(expectedId, myProductId);
        }
예제 #3
0
        public void EndTeansaction_PutInMoneyExit_SameAmountProductsLeftInVendor()
        {
            //Arrange
            Vending        myVendor              = new Vending(); // vending machine is now populated with standard products
            List <Product> collection            = myVendor.GetProducts();
            int            expectedNumberOfItems = 3;

            //Act
            myVendor.InsertMoney((MyLocalCurrency)100); // Even if ve pretend to buy, we need money!
            myVendor.EndTeansaction();
            int numberOfItems2 = collection.Count;

            //Assert
            Assert.Equal(expectedNumberOfItems, numberOfItems2);
        }
예제 #4
0
        public void Constructor_Create_ThreeItems()
        {
            //Arrange
            Vending        myVendor           = new Vending(); // vending machine is now populated with standard products
            int            expectedSumOfItems = 3;
            int            numberOfItems      = 0;
            List <Product> collection         = myVendor.GetProducts();

            //Act
            foreach (var item in collection)
            {
                numberOfItems++;
            }
            //Assert
            Assert.Equal(expectedSumOfItems, numberOfItems);
        }
예제 #5
0
        public void Purchase_PutIn3ItemsBuy1_LessItemsLeftOnlyTwoItemsLeft()  //???
        {
            //Arrange
            Vending        myVendor              = new Vending(); // vending machine is now populated with standard products
            List <Product> collection            = myVendor.GetProducts();
            int            expectedNumberOfItems = 2;

            //Act
            myVendor.InsertMoney((MyLocalCurrency)100); // Even if ve pretend to buy, we need money!
            int NumberOfItems1 = collection.Count;

            myVendor.Purchase(1);                       // Purchase the first item in Vendor
            int NumberOfItems2 = collection.Count;

            //Assert
            Assert.NotEqual(NumberOfItems1, NumberOfItems2);
            Assert.Equal(expectedNumberOfItems, NumberOfItems2);
        }