Esempio n. 1
0
        public void UpdateDocument_UpdatesDocument()
        {
            var document = _context.Documents.SingleOrDefault(x => x.Description == "Doc2");

            Assert.IsNotNull(document);

            document.Description = "Doc2Update";
            document.Url         = "http://ftp.test.com/doc2update";

            _controller.UpdateDocument((document));

            var result = _context.Documents.SingleOrDefault(x => x.Description == "Doc2Update");

            Assert.IsNotNull(result);
            Assert.AreEqual("http://ftp.test.com/doc2update", result.Url);
        }
Esempio n. 2
0
        public async Task TestUpdateDocumentNoContentResult()
        {
            //Arrange
            var documentCreatedDto =
                new DocumentCreatedEventDto(Guid.Empty, DateTime.UtcNow, Guid.Empty, "1234", string.Empty);
            var readEventsFunc = TestHelper.ValidReadEventsFunc(documentCreatedDto.ToEvent());

            var command = new UpdateDocumentCommand("1234", "test");

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

            //Act
            var result = await _documentsController.UpdateDocument(Guid.Empty, command);

            //Assert
            var noContentResult = result as NoContentResult;

            Assert.NotNull(noContentResult);
        }