public void Execute_WhenIdDoesNotExist_ShouldReturnErrorMessage() { //---------------Arrange------------------- var id = Guid.NewGuid(); var expected = $"Could not locate item with id [{id}]"; var presenter = new ResultFreePropertyPresenter <ErrorOutputMessage>(); var testContext = new DeleteTodoItemUseCaseTestDataBuilder().WithDeleteResult(false).Build(); var usecase = testContext.UseCase; var message = new DeleteTodoInput { Id = id }; //---------------Act------------------- usecase.Execute(message, presenter); //---------------Assert------------------- Assert.AreEqual(expected, presenter.ErrorContent.Errors[0]); }
public void Execute_WhenIdExist_ShouldReturnEmptyResponse() { //---------------Arrange------------------- var id = Guid.NewGuid(); var presenter = new ResultFreePropertyPresenter <ErrorOutputMessage>(); var testContext = new DeleteTodoItemUseCaseTestDataBuilder().WithDeleteResult(true).Build(); var usecase = testContext.UseCase; var message = new DeleteTodoInput { Id = id }; //---------------Act------------------- usecase.Execute(message, presenter); //---------------Assert------------------- Assert.IsFalse(presenter.IsErrorResponse()); testContext.Repository.Received(1).Persist(); }