Example #1
0
 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());
        }
Example #3
0
 public static IEnumerable <Resource> GetExpectedResources(WebTestInfo webTest, params Uri[] uris)
 {
     return(Resource.Create(webTest.Ripper, uris.Prepend(webTest.Uri).ToArray()).ToList());
 }
Example #4
0
        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));
        }
Example #5
0
 public static IEnumerable <Resource> GetExpectedResources(WebTestInfo webTest)
 {
     return(GetExpectedResources(webTest, new Uri[] { }));
 }
Example #6
0
 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))
 {
 }