public void IsEmpty_EmptyBloomFilter_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);

            Assert.True(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);
        }
        public void MyBloomFilter_WithCorrectNumberOfElementsAndFalsePositiveProb_CreateInstance()
        {
            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);

            Assert.IsType <DictionaryBloomFilter <string> >(filter);
            Assert.Equal(1000, filter.NumberOfElements);
            Assert.Equal(0.01, filter.FalsePositiveProb, 2);
            Assert.Equal(9586, filter.SizeOfBitArray);
            Assert.Equal(7, filter.NumberOfHashFunctions);
        }