Beispiel #1
0
        public void FindByDoneStatusTest()
        {
            //
            People    people = new People();
            ToDoItems toDo   = new ToDoItems();

            PersonSequencer.Reset();
            TodoSequencer.ResetID();

            Person Jane = people.AddNewPerson(1, "Jane", "Doe");

            ToDo item1 = toDo.AddNewToDoNew(1, "Win lotto", false, Jane);
            ToDo item2 = toDo.AddNewToDoNew(1, "Learn to code", true, Jane);

            //Act
            ToDo[] result = toDo.FindByDoneStatus();

            //Assert
            Assert.Contains(item2, result);       //Jane has learned to code
            Assert.DoesNotContain(item1, result); //Jane has not yet won the lotto
        }
Beispiel #2
0
        //xczx
        public ToDo[] FindUnassignedTodoItems()
        {
            //Arrange
            People    people = new People();
            ToDoItems toDo   = new ToDoItems();

            PersonSequencer.Reset();
            TodoSequencer.ResetID();

            Person Jane = people.AddNewPerson(1, "Jane", "Doe");
            Person John = people.AddNewPerson(2, "John", "Doe");

            ToDo item1        = toDo.AddNewToDoNew(1, "Win lotto", false, Jane);
            ToDo item2        = toDo.AddNewToDoNew(2, "Learn to code", true, John);
            ToDo itemNotDone1 = toDo.AddNewToDoNew(3, "Yet to be assigned", false);

            //Act

            ToDo[] result = toDo.FindUnassignedTodo();

            //Assert
            Assert.Contains(itemNotDone1, result);
            Assert.DoesNotContain(item1, result);
        }
Beispiel #3
0
        public void FindByLastnameTest()
        {
            //Arrange
            People    people = new People();
            ToDoItems toDo   = new ToDoItems();

            PersonSequencer.Reset();
            TodoSequencer.ResetID();

            Person Doe   = people.AddNewPerson(1, "Jane", "Doe");
            Person Smith = people.AddNewPerson(2, "John", "Smith");

            ToDo item1 = toDo.AddNewToDoNew(1, "Win lotto", false, Doe);
            ToDo item2 = toDo.AddNewToDoNew(2, "Learn to code", false, Smith);

            //Act

            ToDo[] result  = toDo.FindByLastname(Doe);
            ToDo[] result2 = toDo.FindByLastname(Smith);

            //Assert
            Assert.Contains(item1, result);
            Assert.Contains(item2, result2);
        }
Beispiel #4
0
        public void FindByAssigneeTest()
        {
            //Arrange
            People    people = new People();
            ToDoItems toDo   = new ToDoItems();

            PersonSequencer.Reset();
            TodoSequencer.ResetID();

            Person Jane = people.AddNewPerson(1, "Jane", "Doe");
            Person John = people.AddNewPerson(2, "John", "Doe");

            ToDo item1 = toDo.AddNewToDoNew(1, "Win lotto", false, Jane);
            ToDo item2 = toDo.AddNewToDoNew(2, "Learn to code", true, John);

            //Act

            ToDo[] result  = toDo.FindByAssignee(1);
            ToDo[] result2 = toDo.FindByAssignee(2);

            //Assert
            Assert.Contains(item1, result);
            Assert.Contains(item2, result2);
        }