Exemplo n.º 1
0
        public void Subtract_From_Balance_Raises_Event()
        {
            SimpleWallet wallet        = new SimpleWallet();
            decimal      walletBalance = 0;

            wallet.Add(10);
            IVendingMachineInternal machineInternal = new FakeVendingMachineInternal();

            wallet.Init(machineInternal);
            ((IVendingMachineExternal)machineInternal).WalletValueChanged += balance => { walletBalance = balance; };
            wallet.Subtract(5);

            Assert.That(walletBalance.Equals(5));
        }
Exemplo n.º 2
0
        public void Add_In_Balance_Raises_Event()
        {
            //Arrange
            IWallet wallet = new SimpleWallet();

            //Act
            decimal walletBalance = 0;
            IVendingMachineInternal machineInternal = new FakeVendingMachineInternal();

            wallet.Init(machineInternal);
            ((IVendingMachineExternal)machineInternal).WalletValueChanged += balance => { walletBalance = balance; };
            wallet.Add(10);

            //Assert
            Assert.That(walletBalance.Equals(10));
        }