public void IsEmpty_NonEmptyBloomFilter_ReturnFalse() { var firstHashFunction = new Mock <IHashFunction <string> >(); firstHashFunction.Setup(f => f.ComputeHash(It.IsAny <string>())).Returns(It.IsAny <int>()); var secondHashFunction = new Mock <IHashFunction <string> >(); secondHashFunction.Setup(s => s.ComputeHash(It.IsAny <string>())).Returns(It.IsAny <int>()); int numberOfElements = 1000; double falsePositiveProb = 0.01; DictionaryBloomFilter <string> filter = new DictionaryBloomFilter <string>(numberOfElements, falsePositiveProb, firstHashFunction.Object, secondHashFunction.Object); string word = "foo"; filter.AddItem(word); Assert.False(filter.IsEmpty()); }
public void CheckItem_AfterInsertingSameString_ReturnTrue() { var firstHashFunction = new Mock <IHashFunction <string> >(); firstHashFunction.Setup(f => f.ComputeHash(It.IsAny <string>())).Returns(It.IsAny <int>()); var secondHashFunction = new Mock <IHashFunction <string> >(); secondHashFunction.Setup(s => s.ComputeHash(It.IsAny <string>())).Returns(It.IsAny <int>()); int numberOfElements = 1000; double falsePositiveProb = 0.01; DictionaryBloomFilter <string> filter = new DictionaryBloomFilter <string>(numberOfElements, falsePositiveProb, firstHashFunction.Object, secondHashFunction.Object); string word = "foo"; filter.AddItem(word); bool found = filter.CheckItem(word); Assert.True(found); }