예제 #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;
         }
     }
 }
예제 #2
0
        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());
        }
예제 #3
0
 public static IEnumerable <Resource> GetExpectedResources(WebTestInfo webTest, params Uri[] uris)
 {
     return(Resource.Create(webTest.Ripper, uris.Prepend(webTest.Uri).ToArray()).ToList());
 }
예제 #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));
        }
예제 #5
0
 public static IEnumerable <Resource> GetExpectedResources(WebTestInfo webTest)
 {
     return(GetExpectedResources(webTest, new Uri[] { }));
 }
예제 #6
0
 internal WebTestResponse(Uri uri, WebTestInfo webTest)
 {
     _uri     = uri;
     _webTest = webTest;
 }
예제 #7
0
 internal WebTestRequest(Uri uri, WebTestInfo webTest)
 {
     _uri     = uri;
     _webTest = webTest;
 }
예제 #8
0
 public WebTestInfo(WebTestInfo webTest, string relativeUri, string mimeType, string content) : this(webTest, new Uri(webTest.Uri, relativeUri), mimeType, content)
 {
 }
예제 #9
0
 public WebTestInfo(WebTestInfo webTest, string relativeUri) : this(webTest, new Uri(webTest.Uri, relativeUri))
 {
 }