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


C# Money.MoneyBag类代码示例

本文整理汇总了C#中NUnit.Samples.Money.MoneyBag的典型用法代码示例。如果您正苦于以下问题:C# MoneyBag类的具体用法?C# MoneyBag怎么用?C# MoneyBag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MoneyBag类属于NUnit.Samples.Money命名空间,在下文中一共展示了MoneyBag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BagNegate

		public void BagNegate() 
		{
			// {[12 CHF][7 USD]} negate == {[-12 CHF][-7 USD]}
			Money[] bag= { new Money(-12, "CHF"), new Money(-7, "USD") };
			MoneyBag expected= new MoneyBag(bag);
			Assert.AreEqual(expected, fMB1.Negate());
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:7,代码来源:MoneyTest.cs

示例2: BagSubtract

 public void BagSubtract()
 {
     // {[12 CHF][7 USD]} - {[14 CHF][21 USD] == {[-2 CHF][-14 USD]}
     Money[] bag= { new Money(-2, "CHF"), new Money(-14, "USD") };
     MoneyBag expected= new MoneyBag(bag);
     Assert.AreEqual(expected, fMB1.Subtract(fMB2));
 }
开发者ID:plusql,项目名称:hsqldb-snapshot-20160112,代码行数:7,代码来源:MoneyTest.cs

示例3: BagSimpleAdd

		public void BagSimpleAdd() 
		{
			// {[12 CHF][7 USD]} + [14 CHF] == {[26 CHF][7 USD]}
			Money[] bag= { new Money(26, "CHF"), new Money(7, "USD") };
			MoneyBag expected= new MoneyBag(bag);
			Assert.AreEqual(expected, fMB1.Add(f14CHF));
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:7,代码来源:MoneyTest.cs

示例4: BagMultiply

		public void BagMultiply() 
		{
			// {[12 CHF][7 USD]} *2 == {[24 CHF][14 USD]}
			Money[] bag = { new Money(24, "CHF"), new Money(14, "USD") };
			MoneyBag expected= new MoneyBag(bag);
			Assert.AreEqual(expected, fMB1.Multiply(2));
			Assert.AreEqual(fMB1, fMB1.Multiply(1));
			Assert.IsTrue(fMB1.Multiply(0).IsZero);
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:9,代码来源:MoneyTest.cs

示例5: SetUp

		protected void SetUp() 
		{
			f12CHF= new Money(12, "CHF");
			f14CHF= new Money(14, "CHF");
			f7USD= new Money( 7, "USD");
			f21USD= new Money(21, "USD");

			fMB1= new MoneyBag(f12CHF, f7USD);
			fMB2= new MoneyBag(f14CHF, f21USD);
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:10,代码来源:MoneyTest.cs

示例6: MoneyBagEquals

		public void MoneyBagEquals() 
		{
			//NOTE: Normally we use Assert.AreEqual to test whether two
			// objects are equal. But here we are testing the MoneyBag.Equals()
			// method itself, so using AreEqual would not serve the purpose.
			Assert.IsFalse(fMB1.Equals(null)); 

			Assert.IsTrue(fMB1.Equals( fMB1 ));
			MoneyBag equal= new MoneyBag(new Money(12, "CHF"), new Money(7, "USD"));
			Assert.IsTrue(fMB1.Equals(equal));
			Assert.IsTrue(!fMB1.Equals(f12CHF));
			Assert.IsTrue(!f12CHF.Equals(fMB1));
			Assert.IsTrue(!fMB1.Equals(fMB2));
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:14,代码来源:MoneyTest.cs

示例7: SimpleBagAdd

		public void SimpleBagAdd() 
		{
			// [14 CHF] + {[12 CHF][7 USD]} == {[26 CHF][7 USD]}
			Money[] bag= { new Money(26, "CHF"), new Money(7, "USD") };
			MoneyBag expected= new MoneyBag(bag);
			Assert.AreEqual(expected, f14CHF.Add(fMB1));
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:7,代码来源:MoneyTest.cs

示例8: Normalize4

		public void Normalize4() 
		{
			// [12 CHF] - {[12 CHF][3 USD]} == [-3 USD]
			Money[] s1 = { new Money(12, "CHF"), new Money(3, "USD") };
			MoneyBag ms1= new MoneyBag(s1);
			Money expected= new Money(-3, "USD");
			Assert.AreEqual(expected, f12CHF.Subtract(ms1));
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:8,代码来源:MoneyTest.cs

示例9: Normalize3

		public void Normalize3() 
		{
			// {[12 CHF][7 USD]} - {[12 CHF][3 USD]} == [4 USD]
			Money[] s1 = { new Money(12, "CHF"), new Money(3, "USD") };
			MoneyBag ms1= new MoneyBag(s1);
			Money expected= new Money(4, "USD");
			Assert.AreEqual(expected, fMB1.Subtract(ms1));
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:8,代码来源:MoneyTest.cs

示例10: Normalize

		public void Normalize() 
		{
			Money[] bag= { new Money(26, "CHF"), new Money(28, "CHF"), new Money(6, "CHF") };
			MoneyBag moneyBag= new MoneyBag(bag);
			Money[] expected = { new Money(60, "CHF") };
			// note: expected is still a MoneyBag
			MoneyBag expectedBag= new MoneyBag(expected);
			Assert.AreEqual(expectedBag, moneyBag);
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:9,代码来源:MoneyTest.cs

示例11: AddMoneyBag

 public IMoney AddMoneyBag(MoneyBag s)
 {
     return (new MoneyBag(s, this)).Simplify();
 }
开发者ID:jasonjef,项目名称:DeliciousNet,代码行数:4,代码来源:MoneyBag.cs

示例12: BagSumAdd

		public void BagSumAdd() 
		{
			// {[12 CHF][7 USD]} + {[14 CHF][21 USD]} == {[26 CHF][28 USD]}
			Money[] bag= { new Money(26, "CHF"), new Money(28, "USD") };
			MoneyBag expected= new MoneyBag(bag);
			Assert.AreEqual(expected, fMB1.Add(fMB2));
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:7,代码来源:MoneyTest.cs

示例13: MixedSimpleAdd

		public void MixedSimpleAdd() 
		{
			// [12 CHF] + [7 USD] == {[12 CHF][7 USD]}
			Money[] bag= { f12CHF, f7USD };
			MoneyBag expected= new MoneyBag(bag);
			Assert.AreEqual(expected, f12CHF.Add(f7USD));
		}
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:7,代码来源:MoneyTest.cs

示例14: MoneyBag

 public MoneyBag(MoneyBag m1, MoneyBag m2)
 {
     AppendBag(m1);
     AppendBag(m2);
 }
开发者ID:jasonjef,项目名称:DeliciousNet,代码行数:5,代码来源:MoneyBag.cs

示例15: AppendBag

 private void AppendBag(MoneyBag aBag)
 {
     foreach (Money m in aBag.fMonies)
         AppendMoney(m);
 }
开发者ID:jasonjef,项目名称:DeliciousNet,代码行数:5,代码来源:MoneyBag.cs


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