コード例 #1
0
            public void TestReduceSum()
            {
                Expression sum = new Sum(Money.Dollar(3), Money.Dollar(4));
                Bank bank = new Bank();

                Money actual = bank.Reduce(sum, "USD");

                Assert.Equal(Money.Dollar(7), actual);
            }
コード例 #2
0
        public void TestSumTimes()
        {
            Expression fiveBucks = Money.Dollar(5);
            Expression tenFrancs = Money.Franc(10);
            Bank bank = new Bank();
            bank.AddRate("CHF", "USD", 2);
            Expression sum = new Sum(fiveBucks, tenFrancs).Times(2);

            Money actual = bank.Reduce(sum, "USD");

            Assert.Equal(Money.Dollar(20), actual);
        }