Exemplo n.º 1
0
        public void TestMixedAddition()
        {
            IMoneyExpression fiveBucks = Money.Dollar(5);
            IMoneyExpression tenFrancs = Money.Franc(10);
            Bank             bank      = new Bank();

            bank.AddRate("CHF", "USD", 2);
            Money result = bank.Reduce(fiveBucks.Plus(tenFrancs), "USD");

            Assert.Equal(Money.Dollar(10), result);
        }
Exemplo n.º 2
0
        public void sum_of_two_franc_with_one_dollar__equals_to_two_dollar() // 2 CHF + 1 USD = 2 USD
        {
            IMoneyExpression franc  = Money.Franc(2);
            IMoneyExpression dollar = Money.Dollar(1);
            var bank = new Bank();

            bank.AddRate("USD", "CHF", 2);
            bank.AddRate("CHF", "USD", 0.5m);

            var reducedAmount = bank.Reduce(dollar.Plus(franc), "USD");

            var expected = Money.Dollar(2);

            reducedAmount.Should().Be(expected);
        }