Exemplo n.º 1
0
        public void ListItemsNotFound_ThrowsNotFoundException()
        {
            var repo = new Mock <IResourceRepository>();

            repo.Setup(x => x.List("part2")).Returns(new List <Resource>());
            var domain = new ResourceDomain(repo.Object);

            Should.Throw <NotFoundException>(() => domain.List("part2"));
        }
Exemplo n.º 2
0
        public void ListItems_AreMapped()
        {
            var repo = new Mock <IResourceRepository>();

            repo.Setup(x => x.List("part1"))
            .Returns(new List <Resource> {
                new Resource {
                    Key = "key1", Partition = "part1", Value = "value1"
                }
            });
            var domain = new ResourceDomain(repo.Object);

            var items = domain.List("part1").ToList();

            items.Count.ShouldBe(1);
            items[0].Key       = "key1";
            items[0].Partition = "part1";
            items[0].Value     = "value1";
        }