public void FindUnassignedTest() { // Arrange People people = new People(); TodoItems todo = new TodoItems(); PersonSequencer.Reset(); TodoSequencer.Reset(); Person lasse = people.NewPerson("Lasse", "Nääf"); Person albin = people.NewPerson("Albin", "Ek"); Todo job1 = todo.NewTodoItem("Do this", false, lasse); Todo job2 = todo.NewTodoItem("Do this", true, lasse); Todo job3 = todo.NewTodoItem("Do this", true, albin); Todo jobRight = todo.NewTodoItem("This is the one"); Todo jobRight2 = todo.NewTodoItem("This is the other one"); // Act Todo[] actual = todo.FindUnassignedTodoItems(); // Assert Assert.True(actual.Length == 2); Assert.Contains(jobRight, actual); Assert.Contains(jobRight2, actual); Assert.DoesNotContain(job1, actual); Assert.DoesNotContain(job2, actual); Assert.DoesNotContain(job3, actual); }
public void RemoveTodoItemTest() { // Arrange TodoItems todo = new TodoItems(); TodoSequencer.Reset(); int expected = 4; int taskId = 2; //creates many todo items Todo job1 = todo.NewTodoItem("Do this"); Todo job2 = todo.NewTodoItem("Do that"); Todo job3 = todo.NewTodoItem("Do this again"); Todo job4 = todo.NewTodoItem("This is the job"); Todo job5 = todo.NewTodoItem("This is the other job"); // Act todo.RemoveTodoItem(taskId); int size = todo.Size(); // get size Todo[] actual = todo.FindAllTodo(); //get array // Assert Assert.Equal(expected, size); Assert.Contains(job1, actual); Assert.DoesNotContain(job2, actual);// checkthat it has actually been removed Assert.Contains(job3, actual); Assert.Contains(job4, actual); Assert.Contains(job5, actual); }
public void FindByDoneStatusTest() { // Arrange People people = new People(); TodoItems todo = new TodoItems(); PersonSequencer.Reset(); TodoSequencer.Reset(); Person lasse = people.NewPerson("Lasse", "Nääf"); Person nils = people.NewPerson("Nils", "Korv"); Person albin = people.NewPerson("Albin", "Ek"); Todo job1 = todo.NewTodoItem("Do this", false, lasse);// sets false to check that it is excluded in method Todo job2 = todo.NewTodoItem("Do this", true, nils); Todo job3 = todo.NewTodoItem("Do this", true, albin); // Act Todo[] actual = todo.FindByDoneStatus(); // Assert Assert.True(actual.Length == 2);// checks that its actually two objects instead of three Assert.Contains(job2, actual); Assert.Contains(job3, actual); Assert.DoesNotContain(job1, actual); }
public void FindByAssigneePersonTest() { // Arrange People people = new People(); TodoItems todo = new TodoItems(); PersonSequencer.Reset(); TodoSequencer.Reset(); Person lasse = people.NewPerson("Lasse", "Nääf"); Person albin = people.NewPerson("Albin", "Ek"); Todo job1 = todo.NewTodoItem("Do this", false, lasse); Todo job2 = todo.NewTodoItem("Do this", true, lasse); Todo job3 = todo.NewTodoItem("Do this", true, albin); // Act Todo[] actual = todo.FindByAssignee(lasse); //uses person object as parameter Todo[] actual2 = todo.FindByAssignee(albin); // Assert Assert.True(actual.Length == 2); Assert.True(actual2.Length == 1); Assert.Contains(job1, actual); Assert.Contains(job2, actual); Assert.Contains(job3, actual2); }
public void TodoFindByIdTest() { // Arrange int todoId = 1; int todoId2 = 2; int todoId3 = 3; TodoItems todo = new TodoItems(); TodoSequencer.Reset(); todo.NewTodoItem("Do this"); todo.NewTodoItem("Do that"); // Act Todo actual = todo.FindByIdTodo(todoId); Todo actual2 = todo.FindByIdTodo(todoId2); Todo actual3 = todo.FindByIdTodo(todoId3); // Assert Assert.Contains("Do this", actual.ToDoInformation()); Assert.Contains("Do that", actual2.ToDoInformation()); Assert.True(actual3 == null); }
public void TodoFindAllTest() { // Arrange TodoSequencer.Reset(); TodoItems todo = new TodoItems(); todo.NewTodoItem("Do this"); todo.NewTodoItem("Do that"); // Act Todo[] actual = todo.FindAllTodo(); // Assert Assert.True(actual.Length == 2); }
public void TodoSizeTest() { // Arrange TodoSequencer.Reset(); TodoItems todo = new TodoItems(); //creates object to call method with int expected = 2; todo.NewTodoItem("Do this"); todo.NewTodoItem("Do that"); // Act int actual = todo.Size(); // Assert Assert.Equal(expected, actual); }
public void TodoClearTest() { // Arrange int expected = 0; TodoItems todo = new TodoItems(); TodoSequencer.Reset(); todo.NewTodoItem("Do this"); todo.NewTodoItem("Do that"); // Act todo.ClearTodo(); int actual = todo.Size(); // Assert Assert.Equal(actual, expected); }
public void NewTodoItemTest() { // Arrange TodoItems todo = new TodoItems(); string description = "Do this"; int expectedId = 1; TodoSequencer.Reset(); // Act Todo result = todo.NewTodoItem(description); // Assert Assert.NotNull(result); Assert.Contains(description, result.ToDoInformation()); Assert.Contains(expectedId.ToString(), result.ToDoInformation()); }