public void AddNewTask_WithACompletitionDate_ShouldShowACompletitionDateIndicator(bool addCompletitionDate) { //Arrange string title = "Title"; string content = $"This task has a completition date = {addCompletitionDate}"; int initialNumberOfTask = TasksPage.GetCurrentNumberOfTasks(); int taskIndex = initialNumberOfTask; TasksPage.GoToNewTaskPage(); //Act NewTaskPage.ShowAddEditCompletitionDate().AddCompletitionDate(addCompletitionDate); bool dateWasAdded = NewTaskPage.CompletitionDateIsShown(); NewTaskPage.AddEditNewTask(title, content); //Assert int finalNumberOfTasks = TasksPage.GetCurrentNumberOfTasks(); Assert.True(initialNumberOfTask + 1 == finalNumberOfTasks); Assert.AreEqual(title, TasksPage.GetTaskTitle(taskIndex)); Assert.AreEqual(content, TasksPage.GetTaskContent(taskIndex)); if (addCompletitionDate) { Assert.True(dateWasAdded); Assert.True(TasksPage.HasACompletitionDateSet(taskIndex)); } else { Assert.True(!dateWasAdded); Assert.True(!TasksPage.HasACompletitionDateSet(taskIndex)); } }
public void EditTask_ExistingTask_TaskIsTotallyEdited() { //Arrange string newTitle = "Edited title"; string newContent = "This task is edited"; string subTaskTitle = "This is subtask of an edited task"; int initialNumberOfTask = TasksPage.GetCurrentNumberOfTasks(); int taskIndex = initialNumberOfTask - 1; TasksPage.GoToNewTaskPage(taskIndex); //Act //Here we basically edit everything NewTaskPage.ShowAddEditCompletitionDate() .AddCompletitionDate(true) .ShowAddReminderDialog(); TaskMenuOptionsDialog.AddAReminder(true); NewTaskPage.ShowAddSubTaskDialog(); TaskMenuOptionsDialog.AddSubTask(true, subTaskTitle); NewTaskPage.AddEditNewTask(newTitle, newContent); //Assert int finalNumberOfTasks = TasksPage.GetCurrentNumberOfTasks(); Assert.AreEqual(initialNumberOfTask, finalNumberOfTasks); Assert.AreEqual(newTitle, TasksPage.GetTaskTitle(taskIndex)); Assert.AreEqual(newContent, TasksPage.GetTaskContent(taskIndex)); Assert.True(TasksPage.HasACompletitionDateSet(taskIndex)); Assert.True(TasksPage.HasAReminderDateSet(taskIndex)); TasksPage.ShowSubTasks(taskIndex); Assert.True(TasksPage.HasSubTasks(taskIndex)); }