public void test_currency_times_n_then_return_amount_multiplied_by_n()
        {
            //Given
            var fiveTWD = FakeMoneyBuilder.CreateTWD(5);
            //When
            var ans = exchange.Times(fiveTWD, 5);

            //Then
            Assert.Equal(FakeMoneyBuilder.CreateTWD(25), ans);
        }
Beispiel #2
0
 public void test_money_with_same_amount_should_equality()
 {
     //given
     var fiveNT = FakeMoneyBuilder.CreateTWD(5);
     var fivebucks = FakeMoneyBuilder.CreateUSD(5);
     //when
     //then
     Assert.Equal(fiveNT,FakeMoneyBuilder.CreateTWD(5));
     Assert.Equal(fivebucks, FakeMoneyBuilder.CreateUSD(5));
     Assert.NotEqual(fivebucks, fiveNT);
 }
        public void test_currency_exchange_to_another_currency()
        {
            //Given
            var usd     = Currency.Create("USD", 2);
            var fiveTWD = FakeMoneyBuilder.CreateTWD(5);
            //When
            var bucks = exchange.ExchangeTo(fiveTWD, usd);

            //Then
            Assert.True(bucks.Currency.Equals(usd));
            Assert.Equal(1, bucks.Amount);
        }
        public void test_subtraction_of_money_gives_correct_amount()
        {
            //Given
            var profit      = FakeMoneyBuilder.CreateTWD(10);
            var cost        = FakeMoneyBuilder.CreateTWD(3);
            var except_earn = FakeMoneyBuilder.CreateTWD(7);
            //When
            var actual_earn = exchange.Subtraction(profit, cost);

            //Then
            Assert.Equal(except_earn, actual_earn);
        }
        public void test_sum_of_money_gives_full_amount()
        {
            //Given

            var money1 = FakeMoneyBuilder.CreateTWD(5);
            var money2 = FakeMoneyBuilder.CreateUSD(10);
            var money3 = FakeMoneyBuilder.CreateTWD(3);
            //When
            var sum      = exchange.Sum(Currency.Default, money1, money2, money3);
            var banknote = Money.Create(58, Currency.Default);

            //Then
            Assert.Equal(sum, banknote);
        }