Fixed issue in search engine (multiple identical matches returned when search query contained the same work multiple times).
This commit is contained in:
parent
4bb5211191
commit
e225f06bd1
6 changed files with 45 additions and 5 deletions
|
@ -95,6 +95,25 @@ namespace ScrewTurn.Wiki.SearchEngine.Tests {
|
|||
Assert.IsFalse(collection.Contains(""), "Contains should return false");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ContainsOccurrence() {
|
||||
WordInfoCollection collection = new WordInfoCollection();
|
||||
|
||||
WordInfo mi1 = new WordInfo("continuous", 7, 0, WordLocation.Content);
|
||||
|
||||
collection.Add(mi1);
|
||||
|
||||
Assert.IsTrue(collection.ContainsOccurrence("continuous", 7), "Collection should contain occurrence");
|
||||
Assert.IsFalse(collection.ContainsOccurrence("continuous2", 7), "Collection should not contain occurrence");
|
||||
Assert.IsFalse(collection.ContainsOccurrence("continuous", 6), "Collection should not contain occurrence");
|
||||
Assert.IsFalse(collection.ContainsOccurrence("continuous", 8), "Collection should not contain occurrence");
|
||||
Assert.IsFalse(collection.ContainsOccurrence("continuous2", 6), "Collection should not contain occurrence");
|
||||
|
||||
Assert.IsFalse(collection.ContainsOccurrence("continuous2", -1), "Contains should return false");
|
||||
Assert.IsFalse(collection.ContainsOccurrence("", 7), "Contains should return false");
|
||||
Assert.IsFalse(collection.ContainsOccurrence(null, 7), "Contains should return false");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyTo() {
|
||||
WordInfoCollection collection = new WordInfoCollection();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue