public void Test_isEquivalent() { Project p1 = new Project("project1","ab1","<project><title>project1</title><abreviation>ab1</abreviation><description><paragraph>paragraphe1</paragraph></description></project>",1); Project p2 = new Project("project1", "ab1", "<project><title>project1</title><abreviation>ab1</abreviation><description><paragraph>paragraphe1</paragraph></description></project>", 1); Project p3 = new Project("project3", "ab1", "<project><title>project1</title><abreviation>ab1</abreviation><description><paragraph>paragraphe1</paragraph></description></project>", 1); Project p4 = new Project("project1", "ab4", "<project><title>project1</title><abreviation>ab1</abreviation><description><paragraph>paragraphe1</paragraph></description></project>", 1); Project p5 = new Project("project1", "ab1", "<project><title>project5</title><abreviation>ab5</abreviation><description><paragraph>paragraphe5</paragraph></description></project>", 1); Project p6 = new Project("project1", "ab1", "<project><title>project1</title><abreviation>ab1</abreviation><description><paragraph>paragraphe1</paragraph></description></project>", 3); Assert.IsTrue(p1.isEquivalent(p2)); Assert.IsFalse(p1.isEquivalent(p3)); Assert.IsFalse(p1.isEquivalent(p4)); Assert.IsFalse(p1.isEquivalent(p5)); Assert.IsFalse(p1.isEquivalent(p6)); }
/// <summary> /// Return true if this project is equivalent to the other project. /// Equivalent means to the two projects have the same properties but /// not neccessarily the same id. /// </summary> /// <param name="other">The project to test with this one</param> /// <returns>True if this project is equivalent, false otherwise</returns> public bool isEquivalent(Project other) { return myName == other.Name && myAbreviation == other.Abreviation && myDescription == other.Description && myNbStudents == other.NbStudents && myClientId == other.ClientId; }