本文整理汇总了C#中Bank.Reduce方法的典型用法代码示例。如果您正苦于以下问题:C# Bank.Reduce方法的具体用法?C# Bank.Reduce怎么用?C# Bank.Reduce使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bank
的用法示例。
在下文中一共展示了Bank.Reduce方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReduceSum
public void ReduceSum()
{
IExpression sum = new Sum(Money.Dollar(3), Money.Dollar(4));
Bank bank = new Bank();
Money result = bank.Reduce(sum, "USD");
Assert.Equal(Money.Dollar(7), result);
}
示例2: 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);
}
示例3: Test_Addition_Of_Money
public void Test_Addition_Of_Money()
{
var bank = new Bank();
ICurrencyExpression sum = Money.Dollar(15).Plus(Money.Dollar(10));
var reduced = bank.Reduce(sum, "USD");
Assert.AreEqual(Money.Dollar(25), reduced);
}
示例4: TestSimpleAddition
public void TestSimpleAddition()
{
var five = Money.Dollar(5);
ICurrencyExpression sum = five.Plus(five);
Bank bank = new Bank();
Money reduced = bank.Reduce(sum, "USD");
Assert.AreEqual(Money.Dollar(10), reduced);
}
示例5: Test_Bank_Reduces_Sum
public void Test_Bank_Reduces_Sum()
{
var bank = new Bank();
var five = Money.Dollar(5);
ICurrencyExpression sum = five.Plus(five);
Money reduced = bank.Reduce(sum, "USD");
Assert.AreEqual(Money.Dollar(10), reduced);
}
示例6: 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);
}
示例7: 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));
}
示例8: 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);
}
示例9: Test_Reduce_Money
public void Test_Reduce_Money()
{
Bank bank = new Bank();
Money result = bank.Reduce(Money.Dollar(2), "USD");
Assert.AreEqual(Money.Dollar(2), result);
}
示例10: 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);
}
示例11: SimpleAddition
public void SimpleAddition()
{
Money five = Money.Dollar(5);
IExpression sum = five.Plus(five);
Bank bank = new Bank();
Money reduced = bank.Reduce(sum, "USD");
Assert.Equal(Money.Dollar(10), reduced);
}
示例12: ReduceMoney
public void ReduceMoney()
{
Bank bank = new Bank();
Money result = bank.Reduce(Money.Dollar(1), "USD");
Assert.Equal(Money.Dollar(1), result);
}
示例13: testSimpleAddition
public void testSimpleAddition()
{
Money five = Money.dollar(5);
IExpression sum = five.Plus(five);
Bank bank = new Bank();
Money reduced = bank.Reduce(sum, "USD");
Assert.AreEqual(reduced, Money.dollar(10));
}
示例14: 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);
}