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); }
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); }
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); }
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); }
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); }
public List <int> CountPrimeNumbers(int max) { return(TaskHandler.Execute(new PrimeNumbersProgression(max))); }