Esempio n. 1
0
        public void MustSuccessfullyValidateRegexProduct()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem(VALID_ENTRY);

            Assert.Equal("Coke", vendorMachine.InitialInputProducts);
        }
Esempio n. 2
0
        public void MustValidateWithErrorTextInputProductNew()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem(string.Concat(VALID_ENTRY, " ", "ProductNew"));

            Assert.False(vendorMachine.IsValid());
        }
Esempio n. 3
0
        public void MustSuccessfullyValidateRegexCoin()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem(VALID_ENTRY);

            Assert.Equal("0.01 0.05 0.10 0.25 0.50 1.00", vendorMachine.InitialInputCoins);
        }
Esempio n. 4
0
        public void MustValidateCoinEntrySuccessfullyTest()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem(VALID_ENTRY);

            Assert.True(vendorMachine.IsValid());
        }
Esempio n. 5
0
        public void MustValidateCoinEntryErrorTest()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem(INVALID_ENTRY);

            Assert.False(vendorMachine.IsValid());
        }
Esempio n. 6
0
        public void MustValidadeInsufficientNoCoin()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

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

            Assert.False(vendorMachine.sufficientInputValue());
        }
Esempio n. 7
0
        public void MustSuccessfullyValidateCurrencySum()
        {
            SystemVendorMachine vendorMachine = new SystemVendorMachine();

            vendorMachine.InputSystem(VALID_ENTRY);

            Assert.True(vendorMachine.IsValid());
            Assert.Equal((decimal)1.91, (decimal)vendorMachine.EnteredValue());
        }
Esempio n. 8
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);
        }
Esempio n. 9
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());
        }
Esempio n. 10
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());
        }
Esempio n. 11
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());
        }
Esempio n. 12
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());
        }
Esempio n. 13
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();
        }