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); }
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()); }