Esempio n. 1
0
        public void ShouldArchiveDocument()
        {
            var testDocument = MakeNew(3);
            var response     = _docsController.Create(testDocument);
            var result       = Assert.IsType <OkObjectResult>(response.Result);

            Assert.NotNull(result.Value);
            var newDocument = Assert.IsType <Document>(result.Value);

            Assert.Null(newDocument.ArchiveTime);

            _docsController.Get(newDocument.Id);

            response = _docsController.Archive(newDocument.Id);
            result   = Assert.IsType <OkObjectResult>(response.Result);
            Assert.NotNull(result.Value);
            var archivedDocument = Assert.IsType <Document>(result.Value);

            Assert.NotNull(archivedDocument.ArchiveTime);
            Assert.Equal(newDocument.Id, archivedDocument.Id);
            Assert.NotEqual(archivedDocument.ArchiveTime, archivedDocument.FirstReadTime);
        }