コード例 #1
0
        public void Should_be_able_to_get_cleared_document_content()
        {
            var document   = _documentFixture.GetDocument(Guid.NewGuid());
            var repository = new DocumentRepository(DatabaseGateway, new DocumentQueryFactory());
            var query      = new DocumentQuery(QueryMapper, new DocumentQueryFactory());

            using (TransactionScopeFactory.Create())
                using (DatabaseContextFactory.Create())
                {
                    Assert.That(query.FindContent(document.Id), Is.Null);

                    repository.Save(document);

                    DocumentContent content = null;

                    Assert.That(() => content = query.FindContent(document.Id), Throws.Nothing);
                    Assert.That(content, Is.Not.Null);
                    Assert.That(content.Status, Is.EqualTo("Registered"));
                    Assert.That(content.Content, Is.Null);
                    Assert.That(content.ContentType, Is.EqualTo(document.ContentType));

                    document.Cleared();

                    repository.Save(document);

                    Assert.That(() => content = query.FindContent(document.Id), Throws.Nothing);
                    Assert.That(content, Is.Not.Null);
                    Assert.That(content.Status, Is.EqualTo("Cleared"));
                    Assert.That(content.Content, Is.Not.Null);
                    Assert.That(content.ContentType, Is.EqualTo(document.ContentType));
                }
        }