Ejemplo n.º 1
0
        public void GetDetialsFromText(bool isExternalLinks, bool isMetaTags, bool isWordCount, bool isStopWord,
                                       string searchText, string spotWordsPath, int linkcount, int metaTagsCount, int wordsCount)
        {
            var anaysler = new AnalyserManager(new SEOBuilderFactory(new WebParserProvider()));

            var @params = new SEOParams()
            {
                IsExternalLinks = isExternalLinks,
                IsMetaTags      = isMetaTags,
                IsWordCount     = isWordCount,
                IsStopWord      = isStopWord,
                SearchText      = searchText,
                SpotWordsPath   = spotWordsPath
            };

            var result = anaysler.GetDetails(@params);

            Assert.AreEqual(result.LinksCount.Count, linkcount);
            Assert.AreEqual(result.MetatagsCount.Count, metaTagsCount);
            Assert.AreEqual(result.WordsCount.Count, wordsCount);
        }
Ejemplo n.º 2
0
        public void GetDeatilsFromUrl(bool isExternalLinks, bool isMetaTags, bool isWordCount, bool isStopWord,
                                      string searchText, string spotWordsPath, int linkcount, int metaTagsCount, int wordsCount)
        {
            var @params = new SEOParams()
            {
                IsExternalLinks = isExternalLinks,
                IsMetaTags      = isMetaTags,
                IsWordCount     = isWordCount,
                IsStopWord      = isStopWord,
                SearchText      = searchText,
                SpotWordsPath   = spotWordsPath
            };
            var data = new SEOData();
            var mockwebParserProvider = Substitute.For <IWebParserProvider>();
            var SEOAnalyserProvider   = Substitute.For <ISEOAnalyserProvider>();
            var mockSEOBuilderFactory = Substitute.For <ISEOBuilderFactory>();

            IDictionary <string, int> linksCount = new Dictionary <string, int>();

            linksCount.Add("hello", 1);
            linksCount.Add("batman", 10);

            IDictionary <string, int> metaTags = new Dictionary <string, int>();

            metaTags.Add("animal", 1);
            metaTags.Add("design", 1);

            SEOAnalyserProvider.GetExternalLinks(@params.SearchText).Returns(linksCount);
            SEOAnalyserProvider.GetMetaTasDetails(@params).Returns(metaTags);
            SEOAnalyserProvider.GetWordsDetails(@params).Returns(new Dictionary <string, int>());
            mockSEOBuilderFactory.Build(@params.SearchText).Returns(SEOAnalyserProvider);
            var AnalyserManager = new AnalyserManager(mockSEOBuilderFactory, data);


            var result = AnalyserManager.GetDetails(@params);

            Assert.AreEqual(result.LinksCount.Count, linksCount.Count);
            Assert.AreEqual(result.MetatagsCount.Count, metaTags.Count);
        }