示例#1
0
        public void GetKeywords_ValidUrl_ReturnKeywords()
        {
            _testObject = new WebPageAdapter();
            var keywords = _testObject.GetKeywords(ValidUrl);

            Assert.IsTrue(keywords.Count > 0);
        }
示例#2
0
        public void GetKeywords_InvalidUrl_ReturnNull()
        {
            _testObject = new WebPageAdapter();
            var keywords = _testObject.GetKeywords(InvalidUrl);

            Assert.IsNull(keywords);
        }
示例#3
0
        public void IsUrlValid_ValidUrl_ReturnTrue()
        {
            _testObject = new WebPageAdapter();
            var isUrlValid = _testObject.IsUrlValid(ValidUrl);

            Assert.IsTrue(isUrlValid);
        }
示例#4
0
        public void IsUrlValid_InvalidUrl_ReturnFalse()
        {
            _testObject = new WebPageAdapter();
            var isUrlValid = _testObject.IsUrlValid(InvalidUrl);

            Assert.IsFalse(isUrlValid);
        }
示例#5
0
        public void GetKeywordOccurrences_InValidUrl_ReturnZero()
        {
            var searchedKeyword            = "wakacje Rogowo";
            var expectedKeywordOccurrences = 0;

            _testObject = new WebPageAdapter();
            var keywordOccurrences = _testObject.GetKeywordOccurrences(searchedKeyword, InvalidUrl);

            Assert.IsTrue(keywordOccurrences == expectedKeywordOccurrences);
        }
示例#6
0
        public void GetKeywordOccurrences_ValidUrlAndKeyword_ReturnNumberOfOccurrence()
        {
            var searchedKeyword            = "wakacje Rogowo";
            var expectedKeywordOccurrences = 3;

            _testObject = new WebPageAdapter();
            var keywordOccurrences = _testObject.GetKeywordOccurrences(searchedKeyword, ValidUrl);

            Assert.IsTrue(keywordOccurrences == expectedKeywordOccurrences);
        }
示例#7
0
        public void GetKeywordOccurrences_ValidUrlAndInvalidKeyword_ReturnZero()
        {
            var searchedKeyword            = "wakacje Kolobrzeg";
            var expectedKeywordOccurrences = 0;

            _testObject = new WebPageAdapter();
            var keywordOccurrences = _testObject.GetKeywordOccurrences(searchedKeyword, ValidUrl);

            Assert.IsTrue(keywordOccurrences == expectedKeywordOccurrences);
        }
示例#8
0
        public void GetKeywordsOccurrences_InvalidUrl_ReturnNull()
        {
            var searchedKeywords = new List <string>();

            searchedKeywords.Add("wakacje Rogowo");
            searchedKeywords.Add("wakacje nad morzem");
            _testObject = new WebPageAdapter();
            var keywordOccurrences = _testObject.GetKeywordsOccurrences(searchedKeywords, InvalidUrl);

            Assert.IsNull(keywordOccurrences);
        }
示例#9
0
        public void GetKeywordsOccurrences_ValidUrl_ReturnListOfKeywordDtoWithOccurrences()
        {
            var searchedKeywords = new List <string>();

            searchedKeywords.Add("wakacje Rogowo");
            searchedKeywords.Add("wakacje nad morzem");
            _testObject = new WebPageAdapter();
            var keywordOccurrences = _testObject.GetKeywordsOccurrences(searchedKeywords, ValidUrl);

            Assert.IsTrue(keywordOccurrences.Count > 0);
            Assert.IsTrue(keywordOccurrences.Any(keyword => keyword.OccurenceCount > 0));
        }
示例#10
0
 private void Init()
 {
     _webPageAdapter = new WebPageAdapter();
 }