コード例 #1
0
        public void Should_ReduceMoney_DifferentCurrency()
        {
            Bank bank = new Bank();

            bank.AddRate("CHF", "USD", 2);
            Assert.AreEqual(2, actual: bank.Rate(CHF, USD));
        }
コード例 #2
0
        public void Should_Different_Plus()
        {
            MoneyExpression sum  = Money.Dollar(5).Plus(Money.Franc(10));
            Bank            bank = new Bank();

            bank.AddRate("CHF", "USD", 2);
            Assert.AreEqual(Money.Dollar(10), sum.Reduce(bank, USD));
        }
コード例 #3
0
        public void Test_Sum_Times()
        {
            MoneyExpression fiveBucks = Money.Dollar(5);
            MoneyExpression tenFrancs = Money.Franc(10);
            Bank            bank      = new Bank();

            bank.AddRate("CHF", "USD", 2);
            MoneyExpression sum    = new Sum(fiveBucks, tenFrancs).Times(2);
            Money           result = bank.Reduce(sum, USD);

            Assert.AreEqual(Money.Dollar(20), result);
        }