Пример #1
0
        public void MustValidadeInsufficientNoCoin()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem("0.01 Coke");
            vendorMachine.CreateProductInput();

            Assert.False(vendorMachine.sufficientInputValue());
        }
Пример #2
0
        public void MustValidadeCreateProductMultipleAmountInputValid()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem("0.01 Coke Coke Coke Coke Coke");
            vendorMachine.CreateProductInput();

            Assert.Equal("Coke", vendorMachine.ProductSelected.Name);
            Assert.Equal(5, vendorMachine.ProductSelected.Amount);
        }
Пример #3
0
        public void WhenRequestingMultipleProducts()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem("1.00 Pastelina Pastelina Pastelina");

            Assert.True(vendorMachine.IsValid());

            vendorMachine.CreateProductInput();

            Assert.Equal("Output: Pastelina = 0.70 Pastelina = 0.40 Pastelina = 0.10", vendorMachine.OutputSystem());
        }
Пример #4
0
        public void WhenThereIsNoChange2()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem("0.25 0.05 0.05 Pastelina CHANGE");

            Assert.True(vendorMachine.IsValid());

            vendorMachine.CreateProductInput();

            Assert.Equal("Output: Pastelina = 0.05", vendorMachine.OutputSystem());
        }
Пример #5
0
        public void InsertTooManyValueForProduct()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem("1.00 Pastelina CHANGE");

            Assert.True(vendorMachine.IsValid());

            vendorMachine.CreateProductInput();

            Assert.Equal("Output: Pastelina = 0.70 0.50 0.10 0.10", vendorMachine.OutputSystem());
        }
Пример #6
0
        public void InsertCoinsAndRequestProduct()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem("0.50 1.00 Coke");

            Assert.True(vendorMachine.IsValid());

            vendorMachine.CreateProductInput();

            Assert.Equal("Output: Coke = 0.00", vendorMachine.OutputSystem());
        }
Пример #7
0
        static void Main(string[] args)
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            while (!vendorMachine.IsValid())
            {
                Console.WriteLine("Coins are 0.01, 0.05, 0.10, 0.25, 0.50 and 1.00");
                Console.WriteLine("Products are Coke (cost 1.50), Water (cost: 1.00) and Pastelina (cost: 0.30)");
                Console.Write("Input: ");
                vendorMachine.InputSystem(Console.ReadLine());
            }

            vendorMachine.CreateProductInput();

            vendorMachine.OutputSystem();

            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }