Пример #1
0
        public void MoveTask_ShouldBeMoved(bool moveIt)
        {
            //Arrange
            int initialNumberOfTask = TasksPage.GetCurrentNumberOfTasks();
            int taskIndex           = initialNumberOfTask - 1;

            TasksPage.GoToNewTaskPage(taskIndex);
            NewTaskPage.ShowMoveTaskDialog();
            int tasksListIndex        = TaskMenuOptionsDialog.GetSelectedTaskListIndex();
            int maxIndex              = TaskMenuOptionsDialog.GetNumberOfTaskLists();
            int selectedTaskListIndex = Enumerable.Range(0, maxIndex).First(value => value != tasksListIndex);

            //Act
            TaskMenuOptionsDialog.MoveToDiffTaskList(moveIt, selectedTaskListIndex);

            //Assert
            if (moveIt)
            {
                NewTaskPage.WaitForPageToLeave();
                TasksPage.AssertOnPage();
                int finalNumberOfTasks = TasksPage.GetCurrentNumberOfTasks();
                Assert.AreEqual(initialNumberOfTask - 1, finalNumberOfTasks);
            }
            else
            {
                ManageTaskListsDialog.AssertOnPage(TimeSpan.FromSeconds(10));
                Assert.True(tasksListIndex == TaskMenuOptionsDialog.GetSelectedTaskListIndex());
            }
        }
        public void MoveToDiffTaskList_ShouldBeMoved(bool moveIt)
        {
            //Arrange
            int initialNumberOfTask = TasksPage.GetCurrentNumberOfTasks();

            TaskMenuOptionsDialog.ShowMainDialog().ShowMoveToDiffTaskListDialog();
            int tasksListIndex        = TaskMenuOptionsDialog.GetSelectedTaskListIndex();
            int maxIndex              = TaskMenuOptionsDialog.GetNumberOfTaskLists();
            int selectedTaskListIndex = Enumerable.Range(0, maxIndex).First(value => value != tasksListIndex);

            //Act
            TaskMenuOptionsDialog.MoveToDiffTaskList(moveIt, selectedTaskListIndex);

            //Assert
            int finalNumberOfTask = TasksPage.GetCurrentNumberOfTasks();

            if (moveIt)
            {
                Assert.True(initialNumberOfTask - 1 == finalNumberOfTask);
            }
            else
            {
                ManageTaskListsDialog.AssertOnPage(TimeSpan.FromSeconds(10));
                Assert.True(initialNumberOfTask == finalNumberOfTask);
                Assert.True(tasksListIndex == TaskMenuOptionsDialog.GetSelectedTaskListIndex());
            }
        }