Пример #1
0
        public async Task GetSearchEngineResultsPagePositions_ValidArguments_Success()
        {
            // Arrange
            const string DOMAIN_TO_MATCH   = "domaintomatch.com";
            const int    RESULT_POSITION_1 = 2;
            var          _SearchResults    = new SearchEngineResult[]
            {
                new SearchEngineResult {
                    Position = 1, ResultLink = "*****@*****.**"
                },
                new SearchEngineResult {
                    Position = RESULT_POSITION_1, ResultLink = DOMAIN_TO_MATCH
                },
                new SearchEngineResult {
                    Position = 3, ResultLink = "*****@*****.**"
                },
            };
            var _Analyser = GoogleResultsPageAnalyserFactory.Create(_SearchResults);

            // Act
            var _Results = await _Analyser.GetSearchEngineResultsPagePositions("random keywords", DOMAIN_TO_MATCH);

            // Assert
            Assert.Collection(_Results, p => Assert.Equal(RESULT_POSITION_1, p));
        } //GetSearchEngineResultsPagePositions_ValidArguments_Success
Пример #2
0
        public async Task GetSearchEngineResultsPagePositions_KeywordsArgumentOverWordLimit_ThrowsValidationException()
        {
            // Arrange
            var _Analyser = GoogleResultsPageAnalyserFactory.Create();
            var _Keywords = string.Join(' ', Enumerable.Range(0, GoogleResultsPageAnalyser.GOOGLE_SEARCH_KEYWORDS_LIMIT + 1));

            // Act
            var _Exception = await Record.ExceptionAsync(() => _Analyser.GetSearchEngineResultsPagePositions(_Keywords, "domaintomatch.com"));

            // Assert
            Assert.NotNull(_Exception);
            Assert.IsType <ValidationException>(_Exception);
        } //GetSearchEngineResultsPagePositions_KeywordsArgumentOverWordLimit_ThrowsValidationException
Пример #3
0
        public async Task GetSearchEngineResultsPagePositions_KeywordsArgumentOverCharacterLimit_ThrowsValidationException()
        {
            // Arrange
            var _Analyser = GoogleResultsPageAnalyserFactory.Create();

            var _Keywords = new string('1', GoogleResultsPageAnalyser.GOOGLE_SEARCH_QUERY_LENGTH_LIMIT + 1);

            // Act
            var _Exception = await Record.ExceptionAsync(() => _Analyser.GetSearchEngineResultsPagePositions(_Keywords, "domaintomatch.com"));

            // Assert
            Assert.NotNull(_Exception);
            Assert.IsType <ValidationException>(_Exception);
        } //GetSearchEngineResultsPagePositions_KeywordsArgumentOverCharacterLimit_ThrowsValidationException