Example #1
0
        public void MoneyBack_SetsBalanceToZero()
        {
            var stub = MockRepository.GenerateStub<IWallet>();
            stub.Stub(s => s.GetBestCoins(0)).IgnoreArguments().Return(new[] { new CoinsPile(1) });

            var o = new Operation(MockRepository.GenerateStub<IWallet>(), stub, MockRepository.GenerateStub<ICook>());
            o.Balance = 100;
            o.MoneyBack();

            Assert.AreEqual(0, o.Balance);
        }
Example #2
0
        public void MoneyBack_MockMachineWallet_TakesBestCoins()
        {
            var mock = MockRepository.GenerateMock<IWallet>();
            mock.Expect(m => m.GetBestCoins(100)).Return(new[] { new CoinsPile(1) });

            var o = new Operation(MockRepository.GenerateStub<IWallet>(), mock, MockRepository.GenerateStub<ICook>());
            o.Balance = 100;
            o.MoneyBack();

            mock.VerifyAllExpectations();
        }