예제 #1
0
        public void SelectNonExistentProductFail()
        {
            var state = new ReadyToSellProduct(
                _wallet,
                _inventory,
                _pricesProvider,
                new VMachine(_wallet, _inventory, _pricesProvider,
                             _changeCalculator
                             )
                );


            Assert.Throws <ProductNotAvailableException>(
                () => state.SelectProduct(Product.Juice)
                );
            Assert.True(state.VendingMachine.State is ReadyToSellProduct);
        }
예제 #2
0
        public void SelectProductAndChangeStateSuccess()
        {
            var state = new ReadyToSellProduct(
                _wallet,
                _inventory,
                _pricesProvider,
                new VMachine(_wallet, _inventory, _pricesProvider,
                             _changeCalculator
                             )
                );

            state.SelectProduct(Product.Espresso);

            Assert.Equal(Product.Espresso,
                         state.SelectedProduct
                         );
            Assert.True(state.VendingMachine.State is ReadyToAcceptCoins);
        }