public async Task TestRejectDocumentReadEventsErrorBadRequestResult() { //Arrange var command = new RejectDocumentCommand("Reject"); const string error = "testError"; _documentsController = new DocumentsController(TestHelper.ReadEventsFuncWithError(error), TestHelper.SaveAndPublish, DocumentExistsByNumber, TestHelper.GetDocumentById(), TestHelper.GetCurrentUserId()); //Act var result = await _documentsController.RejectDocument(Guid.Empty, command); //Assert var badRequestResult = result as BadRequestObjectResult; Assert.NotNull(badRequestResult); Assert.NotNull(badRequestResult.Value); }
public async Task TestRejectDocumentInvalidCommandBadRequestResult() { //Arrange var command = new RejectDocumentCommand(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.RejectDocument(Guid.Empty, command); //Assert var badRequestResult = result as BadRequestObjectResult; Assert.NotNull(badRequestResult); Assert.NotNull(badRequestResult.Value); }
public async Task TestRejectDocumentNoContentResult() { //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 RejectDocumentCommand("Bad document"); _documentsController = new DocumentsController(readEventsFunc, TestHelper.SaveAndPublish, DocumentExistsByNumber, TestHelper.GetDocumentById(), TestHelper.GetCurrentUserId()); //Act var result = await _documentsController.RejectDocument(Guid.Empty, command); //Assert var noContentResult = result as NoContentResult; Assert.NotNull(noContentResult); }