Esempio n. 1
0
        public void Contains_NonExistent_ReturnsFalse()
        {
            Assert.IsFalse(_unitUnderTest.Contains(_uri1));
            Assert.IsFalse(_unitUnderTest.Contains(_uri2));

            _unitUnderTest.AddIfNew(_uri1);

            Assert.IsFalse(_unitUnderTest.Contains(_uri2));
        }
Esempio n. 2
0
        public void NoFalseNegativesTest()
        {
            // create input collection
            List <Uri> inputs = GenerateRandomDataList(10000);

            // instantiate filter and populate it with the inputs
            using (ICrawledUrlRepository uut = GetInstance())
            {
                //If all were unique then they should all return "true" for Contains()
                foreach (Uri input in inputs)
                {
                    Assert.IsTrue(uut.AddIfNew(input));
                }

                //If all were added successfully then they should all return "true" for Contains()
                foreach (Uri input in inputs)
                {
                    if (!uut.Contains(input))
                    {
                        Assert.Fail("False negative: {0}", input);
                    }
                }
            }
        }
Esempio n. 3
0
 public bool IsUriKnown(Uri uri)
 {
     return(_crawledUrlRepo.Contains(uri));
 }
Esempio n. 4
0
 /// <summary>
 /// Returns whether or not the specified Uri was already scheduled to be crawled or simply added to the
 /// list of known Uris.
 /// </summary>
 public bool IsUriKnown(Uri uri)
 {
     return(CrawledUrlRepository.Contains(uri));
 }