예제 #1
0
        public void Restock_BadStuff_ThrowsException()
        {
            // Arrange
            IVMLogic vml = new VMLogic();


            // Act & Assert
            Assert.Throws <ArgumentException>(() => vml.Restock(0, new Cookie()));
            Assert.Throws <ArgumentException>(() => vml.Restock(vml.GetAvailableProducts().Length + 1, new Cookie()));
            Assert.Throws <ArgumentException>(() => vml.Restock(1, null));
        }
예제 #2
0
        public void Restock_GoodStuff_ItsAddedInTheSystem()
        {
            // Arrange
            IVMLogic vml        = new VMLogic();
            IProduct newProduct = new Cookie();
            int      bignumber  = 999;

            while (bignumber-- > 0)
            {
                vml.InsertMoney(vml.GetAcceptableMoneyDenominators()[0]); //Add tons of acceptable money to the system
            }
            // Act
            vml.Restock(2, newProduct);

            // Assert
            Assert.Equal(newProduct, vml.Purchase(2));
        }