Exemple #1
0
        public void FindByDoneStatus_FindOnlyNotDone_Arraysize3()
        {
            //arrange
            int    personId   = PersonSequencer.getNext();
            string firstName  = "Fredrik";
            string familyName = "Persson";
            Person assignee   = new Person(personId, firstName, familyName);

            string description1 = "Walk the dog.";
            string description2 = "Cuddle with cat.";
            string description3 = "Take a walk.";

            ToDoSequencer.Reset();
            ToDoItems todoItems = new ToDoItems();

            todoItems.Clear();

            //add 3 not done
            todoItems.AddToDoItem(assignee, description1);
            todoItems.AddToDoItem(assignee, description2);
            todoItems.AddToDoItem(assignee, description3);

            //set one of the items to done.
            ToDo itemToBeDone = todoItems.FindById(1);

            itemToBeDone.Done = true;

            //act
            ToDo[] foundItemsArray = todoItems.FindByDoneStatus(false);

            //assert
            Assert.Equal(2, foundItemsArray.Length);
        }
Exemple #2
0
        public void FindByDoneStatus_FindOnlyOne_Arraysize1()
        {
            //arrange
            int    personId   = PersonSequencer.getNext();
            string firstName  = "Fredrik";
            string familyName = "Persson";
            Person assignee   = new Person(personId, firstName, familyName);

            string description1 = "Walk the dog.";
            string description2 = "Cuddle with cat.";

            ToDoSequencer.Reset();
            ToDoItems todoItems = new ToDoItems();

            todoItems.Clear();

            //add 2 items
            todoItems.AddToDoItem(assignee, description1);
            todoItems.AddToDoItem(assignee, description2);

            //set one item to done.
            ToDo itemToBeDone = todoItems.FindById(1);

            itemToBeDone.Done = true;

            //act
            ToDo[] foundItemsArray = todoItems.FindByDoneStatus(true);

            //assert
            Assert.Single(foundItemsArray);
            Assert.Equal(description1, foundItemsArray[0].Description);
        }
Exemple #3
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
        }