コード例 #1
0
        public void UpdateMoney()
        {
            CashMoneyRepositoryMoq.UpdateMoney(MockCashMoneyRepository, money);
            CashMoneyRepositoryMoq.GetMoney(MockCashMoneyRepository, money);

            MockCashMoneyRepository.Object.UpdateMoney(10, 2);

            IList <CashMoney> foundMoney = MockCashMoneyRepository.Object.GetCashMoney();

            int quantityValue = foundMoney.Where(cash => cash.MoneyValue == 10).FirstOrDefault().Quantity;

            Assert.AreEqual(12, quantityValue);
        }
コード例 #2
0
        public void GiveChange()
        {
            CashMoneyRepositoryMoq.GiveChange(MockCashMoneyRepository, money);
            CashMoneyRepositoryMoq.GetMoney(MockCashMoneyRepository, money);

            MockCashMoneyRepository.Object.GiveChange(2.5);

            IList <CashMoney> foundMoney = MockCashMoneyRepository.Object.GetCashMoney();

            int quantityValue1  = foundMoney.Where(cash => cash.MoneyValue == 1).FirstOrDefault().Quantity;
            int quantityValue05 = foundMoney.Where(cash => cash.MoneyValue == 0.5).FirstOrDefault().Quantity;

            Assert.AreEqual(8, quantityValue1);
            Assert.AreEqual(9, quantityValue05);
        }