コード例 #1
0
        public void Test_Money_Reduce()
        {
            Bank  bank   = new Bank();
            Money result = bank.Reduce(Money.Dollar(1), "USD");

            Assert.AreEqual(Money.Dollar(1), result);
        }
コード例 #2
0
        public void TestReduceSum()
        {
            var   sum    = new Sum(Money.Dollar(3), Money.Dollar(4));
            Bank  bank   = new Bank();
            Money result = bank.Reduce(sum, "USD");

            Assert.AreEqual(Money.Dollar(7), result);
        }
コード例 #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);
        }