Example #1
0
 public TestHttpSourceProvider(Dictionary <string, string> responses, TestHttpSource httpSource, bool throwOperationCancelledException = false)
     : base(typeof(HttpSourceResource), "testhttpsource", NuGetResourceProviderPositions.First)
 {
     _responses  = responses;
     _httpSource = httpSource;
     _throwOperationCancelledException = throwOperationCancelledException;
 }
Example #2
0
        public override Task <Tuple <bool, INuGetResource> > TryCreate(SourceRepository source, CancellationToken token)
        {
            var httpSource = new TestHttpSource(source.PackageSource, _responses);

            var result = new Tuple <bool, INuGetResource>(true, new HttpSourceResource(httpSource));

            return(Task.FromResult(result));
        }
 /// <summary>
 /// Creates a handler to override url requests to static content
 /// </summary>
 public static TestHttpSourceProvider CreateHttpSource(Dictionary <string, string> responses, string errorContent = "", TestHttpSource httpSource = null)
 {
     return(new TestHttpSourceProvider(responses, httpSource));
 }
Example #4
0
 /// <summary>
 /// Creates a handler to override url requests to static content
 /// </summary>
 public static TestHttpSourceProvider CreateHttpSource(Dictionary <string, string> responses, string errorContent = "", TestHttpSource httpSource = null, bool throwOperationCancelledException = false)
 {
     return(new TestHttpSourceProvider(responses, httpSource, throwOperationCancelledException));
 }
 public TestHttpSourceProvider(Dictionary <string, string> responses, TestHttpSource httpSource)
     : base(typeof(HttpSourceResource), "testhttpsource", NuGetResourceProviderPositions.First)
 {
     _responses  = responses;
     _httpSource = httpSource;
 }