Example #1
0
        public void ShouldBeThrownAExceptionWhenCreateATask()
        {
            // Arrange
            _repositoryTask.Setup(x => x.Insert(It.IsAny <Task>())).Throws(_exception);
            var taskCreatorCmd = TasksBuilder.CreateTaskCreatorCmd("Task One", "Task description");

            // Assert
            var exceptionThrowed = Assert.ThrowsException <Exception>(() => _taskHandler.Execute(taskCreatorCmd));

            Assert.AreEqual(FailMessages.EXCEPTION_FAIL_MESSAGE, exceptionThrowed.Message);
        }
Example #2
0
        public void ShouldBeReturnedOperationResultSuccessWhenExecuteCommandWithValidData()
        {
            // Arrange
            var taskCreatorCmd  = TasksBuilder.CreateTaskCreatorCmd("Task One", "Task description");
            var expectedMessage = SuccessMessages.OPERATION_SUCCESS;

            // Act
            var result = _taskHandler.Execute(taskCreatorCmd);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Success);
            Assert.AreEqual(expectedMessage, result.Message);
        }
Example #3
0
        public void ShouldBeChangedTaskStatusToInProgress()
        {
            // Arrange
            var taskInProgressCmd = TasksBuilder.CreateTaskUpdaterStatusCmd(_defaulTask.Id, TaskStatusCmd.IN_PROGRESS);
            var expectedStatus    = TaskStatus.IN_PROGRESS;

            // Act
            var result = _taskHandler.Execute(taskInProgressCmd);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Success);
            Assert.AreNotEqual(_initialStatus, _defaulTask.Status);
            Assert.AreEqual(expectedStatus, _defaulTask.Status);
        }
Example #4
0
        public void ShouldBeDeletedATask()
        {
            // Arrange
            var taskId         = _defaulTask.Id;
            var taskRemoverCmd = TasksBuilder.CreateTaskRemoverCmd(taskId);

            // Act
            var result = _taskHandler.Execute(taskRemoverCmd);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Success);
            var task = _tasksList.GetByID(taskId);

            Assert.IsNull(task);
        }
Example #5
0
        public void ShouldBeChangedTaskTitle()
        {
            // Arrange
            var newTitle      = "New task Title Changed";
            var taskUpdateCmd = TasksBuilder.CreateTaskUpdaterCmd(_defaulTask.Id, newTitle, "Task one description");

            // Act
            var result = _taskHandler.Execute(taskUpdateCmd);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Success);
            Assert.AreEqual(newTitle, _defaulTask.Title);
        }
Example #6
0
 public List <int> CountPrimeNumbers(int max)
 {
     return(TaskHandler.Execute(new PrimeNumbersProgression(max)));
 }