Ejemplo n.º 1
0
        public void Purchase_InsufficientMoney_ReturnsNull()
        {
            // Arrange
            IVMLogic vml = new VMLogic();


            // Act & Assert
            Assert.Throws <ArgumentException>(() => vml.Purchase(1));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
        public void Purchase_SufficientMoney_ReturnsTheProduct()
        {
            // Arrange
            IVMLogic vml = new VMLogic();

            // Act
            int bignumber = 999;

            while (bignumber-- > 0)
            {
                vml.InsertMoney(vml.GetAcceptableMoneyDenominators()[0]); //Add tons of acceptable money to the system
            }
            ProductInfo pinfo  = vml.GetAvailableProducts()[0];
            IProduct    result = vml.Purchase(1);

            // Assert
            Assert.Equal(pinfo.Id, result.Examine().Id);
        }