public void Hashcode_Should_Change_For_Different_Objects_And_Not_Change_For_Lifetime_Of_Object() { // Arrange TagViewModel model1 = new TagViewModel("tag1"); TagViewModel model2 = new TagViewModel("tag2"); // Act int hashCode1 = model1.GetHashCode(); int hashCode2 = model2.GetHashCode(); int hashCode1a = model1.GetHashCode(); // Assert Assert.That(hashCode1, Is.Not.EqualTo(hashCode2)); Assert.That(hashCode1, Is.EqualTo(hashCode1a)); }
public void hashcode_should_change_for_different_objects_and_not_change_for_lifetime_of_object() { // Arrange TagViewModel model1 = new TagViewModel("tag1"); TagViewModel model2 = new TagViewModel("tag2"); // Act int hashCode1 = model1.GetHashCode(); int hashCode2 = model2.GetHashCode(); int hashCode1a = model1.GetHashCode(); // Assert Assert.That(hashCode1, Is.Not.EqualTo(hashCode2)); Assert.That(hashCode1, Is.EqualTo(hashCode1a)); }