public void TestAllergenHasSameHashCodeAsAllergenWithEqualName() { string name = ExistingAllergensService.ExistingAllergens[0]; Allergen allergen = Allergen.ValueOf(name); Allergen equalAllergen = Allergen.ValueOf(name); int allergenHashCode = allergen.GetHashCode(); int equalAllergenHashCode = equalAllergen.GetHashCode(); Assert.Equal(allergenHashCode, equalAllergenHashCode); }
public void TestAllergenHasDifferentHashCodeAsAllergenWithEqualName() { string name = ExistingAllergensService.ExistingAllergens[0]; Allergen allergen = Allergen.ValueOf(name); Allergen differentAllergen = Allergen.ValueOf(ExistingAllergensService.ExistingAllergens[1]); int allergenHashCode = allergen.GetHashCode(); int differentAllergenHashCode = differentAllergen.GetHashCode(); Assert.NotEqual(allergenHashCode, differentAllergenHashCode); }