Ejemplo n.º 1
0
        public void ReturnsTheMatchingDocSetEntity()
        {
            var entity     = new DocSetEntity();
            var docSetRepo = new Mock <IDocSetRepository>();

            docSetRepo.Setup(m => m.GetEntityById(1)).Returns(entity);
            var suffixIndex = new Mock <ISuffixIndex <SuffixIndexNode> >();

            suffixIndex.Setup(m => m.Retrieve("TheQuery")).Returns(new List <SuffixIndexNode> {
                new SuffixIndexNode {
                    ID = 1
                }
            });
            var indexer = new DocSetIndex(docSetRepo.Object, suffixIndex.Object);

            Assert.AreEqual(1, indexer.Retrieve("TheQuery").Count());
            Assert.AreEqual(1, indexer.Retrieve("TheQuery").First().ID);
        }
Ejemplo n.º 2
0
        public void ReturnsEmptyResultsIfDocSetRepositoryDoesNotContainEntity()
        {
            var docSetRepo  = new Mock <IDocSetRepository>();
            var suffixIndex = new Mock <ISuffixIndex <SuffixIndexNode> >();

            suffixIndex.Setup(m => m.Retrieve("TheQuery")).Returns(Enumerable.Empty <SuffixIndexNode>());
            var indexer = new DocSetIndex(docSetRepo.Object, suffixIndex.Object);

            Assert.AreEqual(0, indexer.Retrieve("TheQuery").Count());
        }