Exemplo n.º 1
0
        public async Task TestGetDocumentHistoryNotFoundResult()
        {
            //Arrange
            _documentsController = new DocumentsController(TestHelper.ValidReadEventsFunc(), TestHelper.SaveAndPublish,
                                                           DocumentExistsByNumber, TestHelper.GetDocumentById(), TestHelper.GetCurrentUserId());

            //Act
            var actionResult = await _documentsController.GetDocumentHistory(Guid.Empty);

            //Assert
            var notFoundResult = actionResult as NotFoundResult;

            Assert.NotNull(notFoundResult);
        }
Exemplo n.º 2
0
        public async Task TestGetDocumentHistoryBadRequestResult()
        {
            //Arrange
            const string error = "testError";

            _documentsController = new DocumentsController(TestHelper.ReadEventsFuncWithError(error), TestHelper.SaveAndPublish,
                                                           DocumentExistsByNumber, TestHelper.GetDocumentById(), TestHelper.GetCurrentUserId());

            //Act
            var actionResult = await _documentsController.GetDocumentHistory(Guid.Empty);

            //Assert
            var badRequestResult = actionResult as BadRequestObjectResult;

            Assert.NotNull(badRequestResult);
            Assert.NotNull(badRequestResult.Value);
        }
Exemplo n.º 3
0
        public async Task TestGetDocumentHistoryOkResult()
        {
            //Arrange
            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 actionResult = await _documentsController.GetDocumentHistory(Guid.Empty);

            //Assert
            var okResult        = actionResult as OkObjectResult;
            var documentHistory = okResult?.Value as IEnumerable <DocumentHistory>;

            Assert.NotNull(okResult);
            Assert.NotNull(documentHistory);
            Assert.Single(documentHistory);
        }