public async Task TestApproveDocumentReadEventsErrorBadRequestResult() { //Arrange var command = new ApproveDocumentCommand("approve"); const string error = "testError"; _documentsController = new DocumentsController(TestHelper.ReadEventsFuncWithError(error), TestHelper.SaveAndPublish, DocumentExistsByNumber, TestHelper.GetDocumentById(), TestHelper.GetCurrentUserId()); //Act var result = await _documentsController.ApproveDocument(Guid.Empty, command); //Assert var badRequestResult = result as BadRequestObjectResult; Assert.NotNull(badRequestResult); Assert.NotNull(badRequestResult.Value); }
public async Task TestApproveDocumentInvalidCommandBadRequestResult() { //Arrange var command = new ApproveDocumentCommand(string.Empty); var documentCreatedDto = new DocumentCreatedEventDto(Guid.Empty, DateTime.UtcNow, Guid.Empty, "1234", string.Empty); var readEventsFunc = TestHelper.ValidReadEventsFunc(documentCreatedDto.ToEvent()); _documentsController = new DocumentsController(readEventsFunc, TestHelper.SaveAndPublish, DocumentExistsByNumber, TestHelper.GetDocumentById(), TestHelper.GetCurrentUserId()); //Act var result = await _documentsController.ApproveDocument(Guid.Empty, command); //Assert var badRequestResult = result as BadRequestObjectResult; Assert.NotNull(badRequestResult); Assert.NotNull(badRequestResult.Value); }
public async Task TestApproveDocumentNoContentResult() { //Arrange var documentCreatedDto = new DocumentCreatedEventDto(Guid.Empty, DateTime.UtcNow, Guid.Empty, "1234", string.Empty); var fileAddedDto = new FileAddedEventDto(Guid.Empty, DateTime.UtcNow, Guid.Empty, "test", string.Empty); var documentSentToApprovalDto = new DocumentSentForApprovalEventDto(Guid.Empty, DateTime.UtcNow); var readEventsFunc = TestHelper.ValidReadEventsFunc(documentCreatedDto.ToEvent(), fileAddedDto.ToEvent(), documentSentToApprovalDto.ToEvent()); var command = new ApproveDocumentCommand("approve"); _documentsController = new DocumentsController(readEventsFunc, TestHelper.SaveAndPublish, DocumentExistsByNumber, TestHelper.GetDocumentById(), TestHelper.GetCurrentUserId()); //Act var result = await _documentsController.ApproveDocument(Guid.Empty, command); //Assert var noContentResult = result as NoContentResult; Assert.NotNull(noContentResult); }