当前位置: 首页>>代码示例>>C#>>正文


C# Bank.AddRate方法代码示例

本文整理汇总了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);
 }
开发者ID:caspencer,项目名称:TddByExampleWalkThrough,代码行数:7,代码来源:UnitTests.cs

示例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);
 }
开发者ID:caspencer,项目名称:TddByExampleWalkThrough,代码行数:9,代码来源:UnitTests.cs

示例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));
 }
开发者ID:ruprict,项目名称:tddbyexamplec-,代码行数:9,代码来源:DollarTest.cs

示例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);
        }
开发者ID:naingyelin,项目名称:TddByExample,代码行数:12,代码来源:Money_Test_Suite.cs

示例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);
        }
开发者ID:naingyelin,项目名称:TddByExample,代码行数:18,代码来源:Money_Test_Suite.cs

示例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);
        }
开发者ID:naingyelin,项目名称:TddByExample,代码行数:11,代码来源:Money_Test_Suite.cs

示例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);
        }
开发者ID:naingyelin,项目名称:TddByExample,代码行数:16,代码来源:Money_Test_Suite.cs

示例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);
 }
开发者ID:caspencer,项目名称:TddByExampleWalkThrough,代码行数:10,代码来源:UnitTests.cs

示例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);
 }
开发者ID:ruprict,项目名称:tddbyexamplec-,代码行数:10,代码来源:DollarTest.cs


注:本文中的Bank.AddRate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。