diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-15 14:31:08 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-03-15 14:31:08 -0700 |
commit | f609820f0486cf92edab48c3fbd5adfc133263bc (patch) | |
tree | 56d1ebda5f75be8d572e0a093b311a81bc920e16 /src/DotNetOpenAuth.Test/Mocks | |
parent | 139c9be97c1ecc42e98426f8bf888eff2ab64659 (diff) | |
download | DotNetOpenAuth-f609820f0486cf92edab48c3fbd5adfc133263bc.zip DotNetOpenAuth-f609820f0486cf92edab48c3fbd5adfc133263bc.tar.gz DotNetOpenAuth-f609820f0486cf92edab48c3fbd5adfc133263bc.tar.bz2 |
Renamed UserAgentResponse to OutgoingWebResponse, and DirectWebResponse to IncomingWebResponse.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Mocks')
-rw-r--r-- | src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs | 8 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs | 14 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs (renamed from src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs) | 8 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs | 10 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs | 4 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Test/Mocks/TestChannel.cs | 4 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs | 8 |
7 files changed, 28 insertions, 28 deletions
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs index b5fc321..56fe8bc 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs @@ -167,12 +167,12 @@ namespace DotNetOpenAuth.Test.Mocks { return responseMessage; } - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { this.ProcessMessageFilter(response, true); - return new CoordinatingUserAgentResponse(response, this.RemoteChannel); + return new CoordinatingOutgoingWebResponse(response, this.RemoteChannel); } - protected override UserAgentResponse SendIndirectMessage(IDirectedProtocolMessage message) { + protected override OutgoingWebResponse SendIndirectMessage(IDirectedProtocolMessage message) { this.ProcessMessageFilter(message, true); // In this mock transport, direct and indirect messages are the same. return this.SendDirectMessageResponse(message); @@ -186,7 +186,7 @@ namespace DotNetOpenAuth.Test.Mocks { return request.Message; } - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { Channel_Accessor accessor = Channel_Accessor.AttachShadow(this.wrappedChannel); return accessor.ReadFromResponseCore(response); } diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs index a533815..6c32495 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOAuthChannel.cs @@ -18,7 +18,7 @@ namespace DotNetOpenAuth.Test.Mocks { internal class CoordinatingOAuthChannel : OAuthChannel { private EventWaitHandle incomingMessageSignal = new AutoResetEvent(false); private IProtocolMessage incomingMessage; - private UserAgentResponse incomingRawResponse; + private OutgoingWebResponse incomingRawResponse; /// <summary> /// Initializes a new instance of the <see cref="CoordinatingOAuthChannel"/> class for Consumers. @@ -41,7 +41,7 @@ namespace DotNetOpenAuth.Test.Mocks { /// </summary> internal CoordinatingOAuthChannel RemoteChannel { get; set; } - internal UserAgentResponse RequestProtectedResource(AccessProtectedResourceRequest request) { + internal OutgoingWebResponse RequestProtectedResource(AccessProtectedResourceRequest request) { ((ITamperResistantOAuthMessage)request).HttpMethod = this.GetHttpMethod(((ITamperResistantOAuthMessage)request).HttpMethods); this.PrepareMessageForSending(request); HttpRequestInfo requestInfo = this.SpoofHttpMethod(request); @@ -52,7 +52,7 @@ namespace DotNetOpenAuth.Test.Mocks { return this.AwaitIncomingRawResponse(); } - internal void SendDirectRawResponse(UserAgentResponse response) { + internal void SendDirectRawResponse(OutgoingWebResponse response) { this.RemoteChannel.incomingRawResponse = response; this.RemoteChannel.incomingMessageSignal.Set(); } @@ -71,13 +71,13 @@ namespace DotNetOpenAuth.Test.Mocks { return this.AwaitIncomingMessage(); } - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { this.RemoteChannel.incomingMessage = CloneSerializedParts(response, null); this.RemoteChannel.incomingMessageSignal.Set(); return null; } - protected override UserAgentResponse SendIndirectMessage(IDirectedProtocolMessage message) { + protected override OutgoingWebResponse SendIndirectMessage(IDirectedProtocolMessage message) { // In this mock transport, direct and indirect messages are the same. return this.SendDirectMessageResponse(message); } @@ -114,9 +114,9 @@ namespace DotNetOpenAuth.Test.Mocks { return response; } - private UserAgentResponse AwaitIncomingRawResponse() { + private OutgoingWebResponse AwaitIncomingRawResponse() { this.incomingMessageSignal.WaitOne(); - UserAgentResponse response = this.incomingRawResponse; + OutgoingWebResponse response = this.incomingRawResponse; this.incomingRawResponse = null; return response; } diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs index 75c68e0..07f9bc9 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// <copyright file="CoordinatingUserAgentResponse.cs" company="Andrew Arnott"> +// <copyright file="CoordinatingOutgoingWebResponse.cs" company="Andrew Arnott"> // Copyright (c) Andrew Arnott. All rights reserved. // </copyright> //----------------------------------------------------------------------- @@ -11,15 +11,15 @@ namespace DotNetOpenAuth.Test.Mocks { using System.Text; using DotNetOpenAuth.Messaging; - internal class CoordinatingUserAgentResponse : UserAgentResponse { + internal class CoordinatingOutgoingWebResponse : OutgoingWebResponse { private CoordinatingChannel receivingChannel; /// <summary> - /// Initializes a new instance of the <see cref="CoordinatingUserAgentResponse"/> class. + /// Initializes a new instance of the <see cref="CoordinatingOutgoingWebResponse"/> class. /// </summary> /// <param name="message">The direct response message to send to the remote channel. This message will be cloned.</param> /// <param name="receivingChannel">The receiving channel.</param> - internal CoordinatingUserAgentResponse(IProtocolMessage message, CoordinatingChannel receivingChannel) { + internal CoordinatingOutgoingWebResponse(IProtocolMessage message, CoordinatingChannel receivingChannel) { ErrorUtilities.VerifyArgumentNotNull(message, "message"); ErrorUtilities.VerifyArgumentNotNull(receivingChannel, "receivingChannel"); diff --git a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs index 75f78ad..51e966b 100644 --- a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs +++ b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs @@ -19,7 +19,7 @@ namespace DotNetOpenAuth.Test.Mocks { using DotNetOpenAuth.Yadis; internal class MockHttpRequest { - private readonly Dictionary<Uri, DirectWebResponse> registeredMockResponses = new Dictionary<Uri, DirectWebResponse>(); + private readonly Dictionary<Uri, IncomingWebResponse> registeredMockResponses = new Dictionary<Uri, IncomingWebResponse>(); private MockHttpRequest(IDirectWebRequestHandler mockHandler) { ErrorUtilities.VerifyArgumentNotNull(mockHandler, "mockHandler"); @@ -40,7 +40,7 @@ namespace DotNetOpenAuth.Test.Mocks { return mock; } - internal void RegisterMockResponse(DirectWebResponse response) { + internal void RegisterMockResponse(IncomingWebResponse response) { ErrorUtilities.VerifyArgumentNotNull(response, "response"); if (this.registeredMockResponses.ContainsKey(response.RequestUri)) { Logger.WarnFormat("Mock HTTP response already registered for {0}.", response.RequestUri); @@ -172,7 +172,7 @@ namespace DotNetOpenAuth.Test.Mocks { var redirectionHeaders = new WebHeaderCollection { { HttpResponseHeader.Location, redirectLocation.AbsoluteUri }, }; - DirectWebResponse response = new CachedDirectWebResponse(origin, origin, redirectionHeaders, HttpStatusCode.Redirect, null, null, new MemoryStream()); + IncomingWebResponse response = new CachedDirectWebResponse(origin, origin, redirectionHeaders, HttpStatusCode.Redirect, null, null, new MemoryStream()); this.RegisterMockResponse(response); } @@ -188,8 +188,8 @@ namespace DotNetOpenAuth.Test.Mocks { this.RegisterMockResponse(errorResponse); } - private DirectWebResponse GetMockResponse(HttpWebRequest request) { - DirectWebResponse response; + private IncomingWebResponse GetMockResponse(HttpWebRequest request) { + IncomingWebResponse response; if (this.registeredMockResponses.TryGetValue(request.RequestUri, out response)) { // reset response stream position so this response can be reused on a subsequent request. response.ResponseStream.Seek(0, SeekOrigin.Begin); diff --git a/src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs b/src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs index 86108fb..c55d176 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestBadChannel.cs @@ -37,11 +37,11 @@ namespace DotNetOpenAuth.Test.Mocks { return base.ReadFromRequest(request); } - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { throw new NotImplementedException(); } - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { throw new NotImplementedException(); } } diff --git a/src/DotNetOpenAuth.Test/Mocks/TestChannel.cs b/src/DotNetOpenAuth.Test/Mocks/TestChannel.cs index a72ab63..3754f01 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestChannel.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestChannel.cs @@ -25,7 +25,7 @@ namespace DotNetOpenAuth.Test.Mocks { : base(messageTypeProvider, bindingElements) { } - protected override IDictionary<string, string> ReadFromResponseCore(DirectWebResponse response) { + protected override IDictionary<string, string> ReadFromResponseCore(IncomingWebResponse response) { throw new NotImplementedException("ReadFromResponseInternal"); } @@ -33,7 +33,7 @@ namespace DotNetOpenAuth.Test.Mocks { throw new NotImplementedException("CreateHttpRequest"); } - protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) { + protected override OutgoingWebResponse SendDirectMessageResponse(IProtocolMessage response) { throw new NotImplementedException("SendDirectMessageResponse"); } } diff --git a/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs b/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs index 9ae87a5..b74c0f0 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs @@ -18,7 +18,7 @@ namespace DotNetOpenAuth.Test.Mocks { /// <summary> /// Gets or sets the callback used to provide the mock response for the mock request. /// </summary> - internal Func<HttpWebRequest, DirectWebResponse> Callback { get; set; } + internal Func<HttpWebRequest, IncomingWebResponse> Callback { get; set; } /// <summary> /// Gets the stream that was written out as if on an HTTP request. @@ -83,11 +83,11 @@ namespace DotNetOpenAuth.Test.Mocks { /// <returns> /// An instance of <see cref="Response"/> describing the response. /// </returns> - public DirectWebResponse GetResponse(HttpWebRequest request) { + public IncomingWebResponse GetResponse(HttpWebRequest request) { return this.GetResponse(request, DirectWebRequestOptions.None); } - public DirectWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options) { + public IncomingWebResponse GetResponse(HttpWebRequest request, DirectWebRequestOptions options) { if (this.Callback == null) { throw new InvalidOperationException("Set the Callback property first."); } @@ -104,7 +104,7 @@ namespace DotNetOpenAuth.Test.Mocks { return this.GetRequestStream(request); } - public DirectWebResponse GetResponse(HttpWebRequest request, bool requireSsl) { + public IncomingWebResponse GetResponse(HttpWebRequest request, bool requireSsl) { ErrorUtilities.VerifyProtocol(!requireSsl || request.RequestUri.Scheme == Uri.UriSchemeHttps, "disallowed request"); var result = this.GetResponse(request); ErrorUtilities.VerifyProtocol(!requireSsl || result.FinalUri.Scheme == Uri.UriSchemeHttps, "disallowed request"); |