コード例 #1
0
 public void TestReduceSum()
 {
     Expression sum = new Sum(Money.CreateDollar(3), Money.CreateDollar(4));
     Bank bank = new Bank();
     Money result = bank.Reduce(sum, "USD");
     Assert.AreEqual(Money.CreateDollar(7), result);
 }
コード例 #2
0
 public void TestSumTimes()
 {
     Expression fiveDollars = Money.CreateDollar(5);
     Expression tenFrancs = Money.CreateFranc(10);
     Bank bank = new Bank();
     bank.AddRate("CHF", "USD", 2);
     Expression sum = new Sum(fiveDollars, tenFrancs).Times(2);
     Money result = bank.Reduce(sum, "USD");
     Assert.AreEqual(Money.CreateDollar(20), result);
 }