本文整理汇总了C#中Money.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Money.GetHashCode方法的具体用法?C# Money.GetHashCode怎么用?C# Money.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Money
的用法示例。
在下文中一共展示了Money.GetHashCode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Two_money_instances_do_not_equal_if_contain_different_money_amounts
public void Two_money_instances_do_not_equal_if_contain_different_money_amounts()
{
Money dollar = new Money(0, 0, 0, 1, 0, 0);
Money hundredCents = new Money(100, 0, 0, 0, 0, 0);
dollar.Should().NotBe(hundredCents);
dollar.GetHashCode().Should().NotBe(hundredCents.GetHashCode());
}
示例2: Two_money_instances_equal_if_contain_the_same_money_amount
public void Two_money_instances_equal_if_contain_the_same_money_amount()
{
Money money1 = new Money(1, 2, 3, 4, 5, 6);
Money money2 = new Money(1, 2, 3, 4, 5, 6);
money1.Should().Be(money2);
money1.GetHashCode().Should().Be(money2.GetHashCode());
}
示例3: MoneyHash
public void MoneyHash()
{
Assert.IsFalse(f12CHF.Equals(null));
Money equal = new Money(12, "CHF");
Assert.AreEqual(f12CHF.GetHashCode(), equal.GetHashCode());
}
示例4: GetHashCodeTest
public void GetHashCodeTest()
{
Currency currency = new Currency("USD", "USD");
Money target = new Money(100, currency);
Money other = new Money(100, currency);
Assert.AreEqual(target.GetHashCode(), other.GetHashCode());
}
示例5: TestMoneyHash
/// <summary>
///
/// </summary>
public void TestMoneyHash()
{
Assertion.Assert(!f12CHF.Equals(null));
Money equal= new Money(12, "CHF");
Assertion.AssertEquals(f12CHF.GetHashCode(), equal.GetHashCode());
}
示例6: TestMoneyEquals
/// <summary>
///
/// </summary>
public void TestMoneyEquals()
{
Assertion.Assert(!f12CHF.Equals(null));
Money equalMoney= new Money(12, "CHF");
Assertion.AssertEquals(f12CHF, f12CHF);
Assertion.AssertEquals(f12CHF, equalMoney);
Assertion.AssertEquals(f12CHF.GetHashCode(), equalMoney.GetHashCode());
Assertion.Assert(!f12CHF.Equals(f14CHF));
}