Exemple #1
0
        public void ValidateChildren()
        {
            Person       father = new Person("King Shan", "Male", ListOfRelations);
            Person       mother = new Person("Queen Anga", "Female", ListOfRelations);
            Relationship spouse = new Relationship(father, mother, "Spouse");

            ListOfRelations.Add(spouse);

            Person       child1    = new Person("Chit", "Male", ListOfRelations);
            Relationship relation1 = new Relationship(mother, child1, "Child");

            ListOfRelations.Add(relation1);

            Person       child2    = new Person("Ish", "Male", ListOfRelations);
            Relationship relation2 = new Relationship(mother, child2, "Child");

            ListOfRelations.Add(relation2);

            Person       wife      = new Person("Vich", "Male", ListOfRelations);
            Relationship relation3 = new Relationship(mother, wife, "Child");

            ListOfRelations.Add(relation3);

            List <String> children = mother.Children(null);

            Assert.AreEqual(children[0], "Chit");
            Assert.AreEqual(children[1], "Ish");
            Assert.AreEqual(children[2], "Vich");
        }