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>()); }
public bool UrlMatches(string actualUrl, DiscoveredUrl expectation) { if (expectation.Url.IsAbsoluteUri) { return(actualUrl.Contains(expectation.Url.OriginalString)); } return(actualUrl.Contains(expectation.Url.OriginalString)); }
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); }
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); }
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); }
public bool Supports(DiscoveredUrl expectation) { return(true); }
public bool Supports(DiscoveredUrl expectation) { return(!string.IsNullOrWhiteSpace(expectation.SourceAttribute.VerificationPattern)); }
public bool UrlMatches(string actualUrl, DiscoveredUrl expectation) { return(expectation.SourceAttribute.VerificationRegex.IsMatch(actualUrl)); }