diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-17 18:12:40 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2013-03-17 18:12:40 -0700 |
commit | 2d2ef93da49ae2f9963e83b67b845fc41824f229 (patch) | |
tree | 60079f2f501159f5a504aebe5c2fa7072f124cce /src/DotNetOpenAuth.Test/CoordinatorBase.cs | |
parent | 6726f043f82d490d89c8403085b1d3d43a88d6c8 (diff) | |
download | DotNetOpenAuth-2d2ef93da49ae2f9963e83b67b845fc41824f229.zip DotNetOpenAuth-2d2ef93da49ae2f9963e83b67b845fc41824f229.tar.gz DotNetOpenAuth-2d2ef93da49ae2f9963e83b67b845fc41824f229.tar.bz2 |
Lots more test build break fixes.
Diffstat (limited to 'src/DotNetOpenAuth.Test/CoordinatorBase.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/CoordinatorBase.cs | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/DotNetOpenAuth.Test/CoordinatorBase.cs b/src/DotNetOpenAuth.Test/CoordinatorBase.cs index 4f712d0..be56de6 100644 --- a/src/DotNetOpenAuth.Test/CoordinatorBase.cs +++ b/src/DotNetOpenAuth.Test/CoordinatorBase.cs @@ -42,7 +42,7 @@ namespace DotNetOpenAuth.Test { } protected internal virtual async Task RunAsync(CancellationToken cancellationToken = default(CancellationToken)) { - IHostFactories hostFactories = new MyHostFactories(this.handlers); + IHostFactories hostFactories = new MockingHostFactories(this.handlers); await this.driver(hostFactories, cancellationToken); } @@ -104,45 +104,5 @@ namespace DotNetOpenAuth.Test { }); } } - - private class MyHostFactories : IHostFactories { - private readonly Handler[] handlers; - - public MyHostFactories(Handler[] handlers) { - this.handlers = handlers; - } - - public HttpMessageHandler CreateHttpMessageHandler() { - return new ForwardingMessageHandler(this.handlers, this); - } - - public HttpClient CreateHttpClient(HttpMessageHandler handler = null) { - return new HttpClient(handler ?? this.CreateHttpMessageHandler()); - } - } - - private class ForwardingMessageHandler : HttpMessageHandler { - private readonly Handler[] handlers; - - private readonly IHostFactories hostFactories; - - public ForwardingMessageHandler(Handler[] handlers, IHostFactories hostFactories) { - this.handlers = handlers; - this.hostFactories = hostFactories; - } - - protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { - foreach (var handler in this.handlers) { - if (handler.Uri.IsBaseOf(request.RequestUri) && handler.Uri.AbsolutePath == request.RequestUri.AbsolutePath) { - var response = await handler.MessageHandler(this.hostFactories, request, cancellationToken); - if (response != null) { - return response; - } - } - } - - return new HttpResponseMessage(HttpStatusCode.NotFound); - } - } } } |