public void Opdracht4a_AddTest3()
        {
            //Arrange
            PersonTree tree = new PersonTree(new Person("Bruce"));

            //Act
            tree.Add(new Person("Jan", 0));
            string result = tree.GetMostEvilPerson();

            //Assert
            Assert.AreEqual("Bruce", result);
        }
Ejemplo n.º 2
0
        private void LinkChooser_Load(object sender, EventArgs e)
        {
            PersonTree.Init(Links);

            /*LinkNode parent = new LinkNode(Links.LocalLink);
             *
             * AddChildren(parent, Links.LocalLink);
             *
             * // dont add root
             *
             * foreach(LinkNode child in parent.Nodes)
             *  LinkTree.Nodes.Add(child);
             *
             * parent.Expand();*/
        }
        public void Opdracht4b_GetAllNamesSorted()
        {
            //Arrange
            PersonTree tree = new PersonTree(new Person("Bruce"));

            tree.Add(new Person("Jan", 0));
            tree.Add(new Person("Jos", 100));
            tree.Add(new Person("Melinda", 90));
            tree.Add(new Person("Wouter", 10));
            //Act
            string result = tree.GetAllNamesSorted();

            //Assert
            Assert.AreEqual("Jan - Wouter - Bruce - Melinda - Jos", result);
        }
Ejemplo n.º 4
0
    private static void FindPerson(Queue <string> queue, FamilyTree tree, string personTreeInput)
    {
        string name     = "";
        string birthday = "";

        if (Char.IsLetter(personTreeInput[0]))
        {
            string   personInfo      = FindFamilyMemberInfo(queue, personTreeInput, "birthday");
            string[] splitPersonInfo = personInfo.Split();
            name     = personTreeInput;
            birthday = splitPersonInfo[2];
        }
        else
        {
            string   personInfo      = FindFamilyMemberInfo(queue, personTreeInput, "name");
            string[] splitPersonInfo = personInfo.Split();
            name     = $"{splitPersonInfo[0]} {splitPersonInfo[1]}";
            birthday = personTreeInput;
        }
        PersonTree personTree = new PersonTree(name, birthday);

        tree.Person = personTree;
    }