本文整理汇总了C#中TestEntity.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# TestEntity.GetHashCode方法的具体用法?C# TestEntity.GetHashCode怎么用?C# TestEntity.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestEntity
的用法示例。
在下文中一共展示了TestEntity.GetHashCode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetHashCode_uses_hash_code_that_was_generated_pre_id_set
public void GetHashCode_uses_hash_code_that_was_generated_pre_id_set()
{
var entity = new TestEntity();
var hash = entity.GetHashCode();
SetEntityId(entity, 1);
Assert.AreEqual(hash, entity.GetHashCode());
}
示例2: GetHashCode_returns_hash_code_of_Id
public void GetHashCode_returns_hash_code_of_Id()
{
var entity = new TestEntity();
long id = 2;
SetEntityId(entity, id);
Assert.AreEqual(id.GetHashCode(), entity.GetHashCode());
}
示例3: HashCodeNeverChanges
public void HashCodeNeverChanges()
{
// Arrange
var ent = new TestEntity();
// Act
int hash1 = ent.GetHashCode();
ent.Id = 123;
int hash2 = ent.GetHashCode();
// Assert
Assert.AreEqual( hash1, hash2 );
}
示例4: HashCodeForSavedIsDifferentForId
public void HashCodeForSavedIsDifferentForId()
{
// Arrange
var ent = new TestEntity { Id = 123 };
// Act
int hash1 = ent.GetHashCode();
ent.Id = 444;
int hash2 = ent.GetHashCode();
// Assert
Assert.AreNotEqual( hash1, hash2 );
}