本文整理汇总了C#中Bank.AddRate方法的典型用法代码示例。如果您正苦于以下问题:C# Bank.AddRate方法的具体用法?C# Bank.AddRate怎么用?C# Bank.AddRate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bank
的用法示例。
在下文中一共展示了Bank.AddRate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReduceMoneyDifferentCurrency
public void ReduceMoneyDifferentCurrency()
{
Bank bank = new Bank();
bank.AddRate("CHF", "USD", 2);
Money result = bank.Reduce(Money.Franc(2), "USD");
Assert.Equal(Money.Dollar(1), result);
}
示例2: MixedAddition
public void MixedAddition()
{
IExpression fiveBucks = Money.Dollar(5);
IExpression 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);
}
示例3: testMixedAddition
public void testMixedAddition()
{
IExpression fiveBucks = Money.dollar(5);
IExpression tenFrancs = Money.franc(10);
Bank bank = new Bank();
bank.AddRate("CHF", "USD", 2);
Money result = bank.Reduce(fiveBucks.Plus(tenFrancs), "USD");
Assert.AreEqual(result, Money.dollar(10));
}
示例4: Test_Money_Add_Different_Currencies
public void Test_Money_Add_Different_Currencies()
{
var bank = new Bank();
ICurrencyExpression tenDollars = Money.Dollar(10);
ICurrencyExpression sixFranc = Money.Franc(6);
ICurrencyExpression sum = tenDollars.Plus(sixFranc);
bank.AddRate("CHF", "USD", 2);
var result = sum.Reduce(bank, "USD");
Assert.AreEqual(Money.Dollar(13), result);
}
示例5: Test_Sum_Plus_Money_Add_Different_Currencies
public void Test_Sum_Plus_Money_Add_Different_Currencies()
{
//Arrange
var bank = new Bank();
bank.AddRate("CHF", "USD", 2);
ICurrencyExpression tenDollars = Money.Dollar(10);
ICurrencyExpression sixFranc = Money.Franc(6);
ICurrencyExpression eightFranc = Money.Franc(8);
//Act
ICurrencyExpression sum = tenDollars.Plus(sixFranc);
sum = sum.Plus(eightFranc);
var result = sum.Reduce(bank, "USD");
//Assert
Assert.AreEqual(Money.Dollar(17), result);
}
示例6: Test_Reduce_Money_Different_Currency
public void Test_Reduce_Money_Different_Currency()
{
Money tenFranc = Money.Franc(10);
Bank bank = new Bank();
bank.AddRate("CHF", "USD", 2);
Money result = bank.Reduce(tenFranc, "USD");
Assert.AreEqual(Money.Dollar(5), result);
}
示例7: Test_Times_Money_Add_Different_Currencies
public void Test_Times_Money_Add_Different_Currencies()
{
//Arrange
var bank = new Bank();
bank.AddRate("CHF", "USD", 2);
ICurrencyExpression tenDollars = Money.Dollar(10);
ICurrencyExpression sixFranc = Money.Franc(6);
//Act
ICurrencyExpression sumThenTimes = tenDollars.Plus(sixFranc).Times(2);
var result = sumThenTimes.Reduce(bank, "USD");
//Assert
Assert.AreEqual(Money.Dollar(26), result);
}
示例8: SumPlusMoney
public void SumPlusMoney()
{
IExpression fiveBucks = Money.Dollar(5);
IExpression tenFrancs = Money.Franc(10);
Bank bank = new Bank();
bank.AddRate("CHF", "USD", 2);
IExpression sum = new Sum(fiveBucks, tenFrancs).Plus(fiveBucks);
Money result = bank.Reduce(sum, "USD");
Assert.Equal(Money.Dollar(15), result);
}
示例9: testSumTimes
public void testSumTimes()
{
IExpression fiveBucks = Money.dollar(5);
IExpression tenFrances = Money.franc(10);
Bank bank = new Bank();
bank.AddRate("CHF", "USD", 2);
IExpression sum = new Sum(fiveBucks, tenFrances).Times(2);
Money result = bank.Reduce(sum, "USD");
Assert.AreEqual(Money.dollar(20), result);
}