Exemplo n.º 1
0
 public bool UrlMatches(string actualUrl, DiscoveredUrl expectation)
 {
     Called      = true;
     Url         = actualUrl;
     Expectation = expectation;
     return(true);
 }
        public void UrlVerificationStrategiesStrategyFor_GivenUrlAttributeWithRegexPattern_ReturnsRegexStrategy()
        {
            var discoveredUrl = new DiscoveredUrl(new Uri("http://tempuri.org"), new UriAttribute("http://tempuri.org", "http://tempuri.org/[a-z]+"));

            var strat = new PassengerConfiguration().UrlVerificationStrategies.StrategyFor(discoveredUrl);

            Assert.That(strat, Is.TypeOf <RegexStrategy>());
        }
        public void UrlVerificationStrategiesStrategyFor_GivenPlainTextUrlAttribute_ReturnsStringContainingStrategy()
        {
            var discoveredUrl = new DiscoveredUrl(new Uri("http://tempuri.org"), new UriAttribute("http://tempuri.org", null));

            var strat = new PassengerConfiguration().UrlVerificationStrategies.StrategyFor(discoveredUrl);

            Assert.That(strat, Is.TypeOf <StringContainingStrategy>());
        }
Exemplo n.º 4
0
        public bool UrlMatches(string actualUrl, DiscoveredUrl expectation)
        {
            if (expectation.Url.IsAbsoluteUri)
            {
                return(actualUrl.Contains(expectation.Url.OriginalString));
            }

            return(actualUrl.Contains(expectation.Url.OriginalString));
        }
Exemplo n.º 5
0
 public IVerifyUrls StrategyFor(DiscoveredUrl discoveredUrl)
 {
     return(this.First(x => x.Supports(discoveredUrl)));
 }
        public void UrlMatches_RelativeUrlStringDoesNotContainsDiscoveredUrl_ReturnsFalse()
        {
            var discoveredUrl = new DiscoveredUrl(new Uri("/test", UriKind.Relative), new UriAttribute("/test"));

            Assert.That(_strat.UrlMatches("http://nopenopenope.org/not-here", discoveredUrl), Is.False);
        }
        public void UrlMatches_RelativeUrlStringContainsDiscoveredUrl_ReturnsTrue()
        {
            var discoveredUrl = new DiscoveredUrl(new Uri("/test", UriKind.Relative), new UriAttribute("/test"));

            Assert.That(_strat.UrlMatches("http://tempuri.org/test", discoveredUrl), Is.True);
        }
        public void UrlMatches_AbsoluteUrlStringDoesNotContainsDiscoveredUrl_ReturnsFalse()
        {
            var discoveredUrl = new DiscoveredUrl(new Uri("http://tempuri.org"), new UriAttribute("http://tempuri.org"));

            Assert.That(_strat.UrlMatches("http://nopenopenope.org/some/path", discoveredUrl), Is.False);
        }
        public void Supports_VerificationPatternProvided_ReturnsTrue()
        {
            var discoveredUrl = new DiscoveredUrl(new Uri("http://tempuri.org"), new UriAttribute("http://tempuri.org", "http://tempuri.org/[a-z]+"));

            Assert.That(_strat.Supports(discoveredUrl), Is.True);
        }
Exemplo n.º 10
0
        public void UrlMatches_VerificationPatternProvidedAndRegexDoesNotMatch_ReturnsFalse()
        {
            var discoveredUrl = new DiscoveredUrl(new Uri("http://tempuri.org"), new UriAttribute("http://tempuri.org", ".+nopenopenope\\.[a-z]+"));

            Assert.That(_strat.UrlMatches("http://tempuri.org", discoveredUrl), Is.False);
        }
Exemplo n.º 11
0
        public void Supports_NoVerificationPatternProvided_ReturnsFalse()
        {
            var discoveredUrl = new DiscoveredUrl(new Uri("http://tempuri.org"), new UriAttribute("http://tempuri.org", null));

            Assert.That(_strat.Supports(discoveredUrl), Is.False);
        }
Exemplo n.º 12
0
 public bool Supports(DiscoveredUrl expectation)
 {
     return(true);
 }
Exemplo n.º 13
0
 public bool Supports(DiscoveredUrl expectation)
 {
     return(!string.IsNullOrWhiteSpace(expectation.SourceAttribute.VerificationPattern));
 }
Exemplo n.º 14
0
 public bool UrlMatches(string actualUrl, DiscoveredUrl expectation)
 {
     return(expectation.SourceAttribute.VerificationRegex.IsMatch(actualUrl));
 }