public void SoundexIndexTest() { IDocumentCorpus corpus = DirectoryCorpus.LoadTextDirectory(directory); DiskSoundEx soundIndex = new DiskSoundEx("./"); soundIndex.BuildSoundexIndex(corpus); soundIndex.GetCount().Should().Be(5); soundIndex.Clear(); }
public void GetPostingsTest_MultipleNames() { //Arrange IDocumentCorpus corpus = DirectoryCorpus.LoadTextDirectory(directory); DiskSoundEx authorIndex = new DiskSoundEx("./"); authorIndex.BuildSoundexIndex(corpus); //Act var actual = authorIndex.GetPostings("yashua ovando"); //Assert actual.Should().HaveCount(2); authorIndex.Clear(); }
public void GetPostingsTest_NotExistingName_ReturnsEmpty() { //Arrange IDocumentCorpus corpus = DirectoryCorpus.LoadTextDirectory(directory); DiskSoundEx authorIndex = new DiskSoundEx("./"); authorIndex.BuildSoundexIndex(corpus); //Act var actual = authorIndex.GetPostings("hella"); //Assert actual.Should().BeEmpty(); authorIndex.Clear(); }
public void GetPostingsTest_SimilarSoundingName() { //Arrange IDocumentCorpus corpus = DirectoryCorpus.LoadTextDirectory(directory); DiskSoundEx authorIndex = new DiskSoundEx("./"); authorIndex.BuildSoundexIndex(corpus); //Act var result1 = authorIndex.GetPostings("bloclic"); var result2 = authorIndex.GetPostings("blacklock"); //Assert result1.Should().BeEquivalentTo(result2); authorIndex.Clear(); }