Example #1
0
        public async Task Document_List_Returns_Documents_In_Order()
        {
            var repo = Substitute.For <IDocumentRepository>();

            repo.ListAllAsync().Returns(GetDocumentList());

            DocumentOrchestrator orchestrator = new DocumentOrchestrator(repo);

            IActionResult result = await orchestrator.ListAsync();

            var typedResult = result as OkObjectResult;
            var value       = typedResult.Value as IEnumerable <DocumentListItem>;

            Assert.AreEqual("order-2", value.First().Name);
            Assert.AreEqual("order-4", value.Skip(1).First().Name);
        }
Example #2
0
        public async Task Document_List_Returns_All_Documents()
        {
            var repo = Substitute.For <IDocumentRepository>();

            repo.ListAllAsync().Returns(GetDocumentList());

            DocumentOrchestrator orchestrator = new DocumentOrchestrator(repo);

            IActionResult result = await orchestrator.ListAsync();

            var typedResult = result as OkObjectResult;
            var value       = typedResult.Value as IEnumerable <DocumentListItem>;

            Assert.IsNotNull(typedResult);
            Assert.AreEqual(200, typedResult.StatusCode);
            Assert.That(value.ToList(), Has.Count.EqualTo(2));
        }