public static IEnumerable <Resource> GetActualResources(WebTestInfo webTest, params WebTestInfo[] subWebTests) { lock (_webTests) { try { _locked = true; _webTests.Add(webTest.Uri, webTest); foreach (var subWebTest in subWebTests) { _webTests.Add(subWebTest.Uri, subWebTest); } return(webTest.Ripper.Resource.RipAsync(RipMode.Create, 0).Result.ToList()); } catch (AggregateException aggregateException) { if (aggregateException.InnerExceptions.Count == 1) { throw aggregateException.InnerException; } else { throw; } } finally { _webTests.Clear(); _locked = false; } } }
public WebTestInfo(WebTestInfo webTest, Uri uri, string mimeType = DefaultParser.MimeType, string content = null) { _rootPath = webTest == null?Path.GetTempFileName() : null; if (_rootPath != null) { File.Delete(_rootPath); } _ripperLazy = new Lazy <Ripper>(() => _rootPath != null ? new Ripper(Uri, _rootPath) : null); Uri = uri; MimeType = mimeType; Content = content; _streamLazy = new Lazy <Stream>(() => Content != null ? new MemoryStream(WebTest.Encoding.GetBytes(Content)) : new MemoryStream()); }
public static IEnumerable <Resource> GetExpectedResources(WebTestInfo webTest, params Uri[] uris) { return(Resource.Create(webTest.Ripper, uris.Prepend(webTest.Uri).ToArray()).ToList()); }
public static IEnumerable <Resource> GetExpectedResources(WebTestInfo webTest, params string[] relativeUriStrings) { var uris = relativeUriStrings.Select(relativeUriString => new Uri(webTest.Uri, relativeUriString)).ToArray(); return(GetExpectedResources(webTest, uris)); }
public static IEnumerable <Resource> GetExpectedResources(WebTestInfo webTest) { return(GetExpectedResources(webTest, new Uri[] { })); }
internal WebTestResponse(Uri uri, WebTestInfo webTest) { _uri = uri; _webTest = webTest; }
internal WebTestRequest(Uri uri, WebTestInfo webTest) { _uri = uri; _webTest = webTest; }
public WebTestInfo(WebTestInfo webTest, string relativeUri, string mimeType, string content) : this(webTest, new Uri(webTest.Uri, relativeUri), mimeType, content) { }
public WebTestInfo(WebTestInfo webTest, string relativeUri) : this(webTest, new Uri(webTest.Uri, relativeUri)) { }