public void TestCleanup()
 {
     _inventory = null;
     _item      = null;
     _billingMachineOperations = null;
     _sodaMachine = null;
 }
        public void TestInit()
        {
            var availableItems = new Dictionary <int, IItem>();

            //Initialize the test inventory
            availableItems = new Dictionary <int, IItem>
            {
                { 1, new Beverage()
                  {
                      Code = 1, Name = "Coke", Rate = 5, Quantity = 100
                  } },
                { 2, new Beverage()
                  {
                      Code = 2, Name = "Fanta", Rate = 5, Quantity = 500
                  } },
                { 3, new Beverage()
                  {
                      Code = 3, Name = "Sprite", Rate = 5, Quantity = 600
                  } }
            };
            _inventory = Substitute.For <IInventory>();
            _inventory.AvailableItems.ReturnsForAnyArgs(availableItems);
            _item = new Beverage()
            {
                Code = 1, Name = "Fanta", Rate = 5, Quantity = 1
            };
            _billingMachineOperations = new BillingMachineOperations(_inventory, _item);
            _sodaMachine = new SodaMachine(_billingMachineOperations, _item);
            _billingMachineOperations.ClearBalance();
        }
示例#3
0
        private static void ExitTransaction(IMachineOperations ops)
        {
            var returnAmount = ops.ExitTransaction();

            Console.WriteLine(returnAmount > 0
                ? $"Please collect {returnAmount}kr from cash holder"
                : "All inserted money consumed in transactions or no amount inserted.Have a nice day!!!");

            ShowWelcomeScreen();
        }
示例#4
0
 public StartAppCommand(INavigator navigator, IUserWallet userWallet, IMachineOperations machineOperations)
 {
     Navigator = navigator;
     UserWallet = userWallet;
     MachineOperations = machineOperations;
 }
示例#5
0
 public SodaMachine(IMachineOperations machineOperations, IItem item)
 {
     _sodaMachineOps = machineOperations;
     _item           = item;
 }