public void AccountOrganization_2CallsOfGetHashCode_MustReturnSameValues() { var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson)) { Id = 1 }; var org1 = new AccountOrganization("Тест", "Тест", jp1) { Id = 5 }; var hashCode1 = org1.GetHashCode(); var hashCode2 = org1.GetHashCode(); Assert.IsTrue(hashCode1 == hashCode2); }
public void AccountOrganization_DifferentIds_MustHaveDifferent_HashCodes() { var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson)) { Id = 1 }; var org1 = new AccountOrganization("Тест", "Тест", jp1) { Id = 5 }; var org2 = new AccountOrganization("Тест", "Тест", jp1) { Id = 6 }; Assert.IsFalse(org1.GetHashCode() == org2.GetHashCode()); }
public void AccountOrganization_ZeroIds_DifferentValues_ShouldHaveDifferent_HashCodes() { var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson)) { Id = 1 }; var org1 = new AccountOrganization("Тест1", "Тест1", jp1) { Id = 0 }; var jp2 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson)) { Id = 2 }; var org2 = new AccountOrganization("Тест2", "Тест2", jp2) { Id = 0 }; Assert.IsFalse(org1.GetHashCode() == org2.GetHashCode()); }
public void AccountOrganization_SameIds_MustHaveEqual_HashCodes() { var jp1 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson)) { Id = 1 }; var org1 = new AccountOrganization("Тест1", "Тест1", jp1) { Id = 5 }; var jp2 = new JuridicalPerson(new LegalForm("ООО", EconomicAgentType.JuridicalPerson)) { Id = 2 }; var org2 = new AccountOrganization("Тест", "Тест2", jp2) { Id = 5 }; Assert.IsTrue(org1.GetHashCode() == org2.GetHashCode()); }