Esempio n. 1
0
        public async Task TestCreateDocumentInvalidCommandBadRequestResult()
        {
            //Arrange
            var command = new CreateDocumentCommand(string.Empty, "test");

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

            //Act
            var result = await _documentsController.CreateDocument(command);

            //Assert
            var badRequestResult = result as BadRequestObjectResult;

            Assert.NotNull(badRequestResult);
            Assert.NotNull(badRequestResult.Value);
        }
Esempio n. 2
0
        public async Task TestCreateDocumentCreatedResult()
        {
            //Arrange
            var command = new CreateDocumentCommand("1234", "test");

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

            //Act
            var result = await _documentsController.CreateDocument(command);

            //Assert
            var createdResult = result as CreatedResult;

            Assert.NotNull(createdResult);
            Assert.NotNull(createdResult.Location);
        }
Esempio n. 3
0
        public async Task TestCreateDocumentDocumentExistsBadRequestResult()
        {
            //Arrange
            var command = new CreateDocumentCommand("1234", "test");
            var documentExistsByNumber = new DocumentRepository.DocumentExistsByNumber(_ => Task.FromResult(true));

            _documentsController = new DocumentsController(TestHelper.ValidReadEventsFunc(), TestHelper.SaveAndPublish,
                                                           documentExistsByNumber, TestHelper.GetDocumentById(), TestHelper.GetCurrentUserId());

            //Act
            var result = await _documentsController.CreateDocument(command);

            //Assert
            var badRequestResult = result as BadRequestObjectResult;

            Assert.NotNull(badRequestResult);
            Assert.NotNull(badRequestResult.Value);
        }