summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/Mocks
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-01-03 08:37:01 -0800
committerAndrew <andrewarnott@gmail.com>2009-01-03 08:37:01 -0800
commitbc816ee12352c93eb6c47796c0a9cb76a3f68d0b (patch)
tree19a27ea231f165fef761327e61d88e5c41ad0d4d /src/DotNetOpenAuth.Test/Mocks
parentd1cdbd8cbc5ee5901ff8d4e81ba7b3a84f1188dd (diff)
downloadDotNetOpenAuth-bc816ee12352c93eb6c47796c0a9cb76a3f68d0b.zip
DotNetOpenAuth-bc816ee12352c93eb6c47796c0a9cb76a3f68d0b.tar.gz
DotNetOpenAuth-bc816ee12352c93eb6c47796c0a9cb76a3f68d0b.tar.bz2
Fixed mock CoordinatingChannel to send direct responses and indirect messages while more truly simulating the ordinary channel experience.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Mocks')
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs9
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs29
2 files changed, 35 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
index 2c10db9..6fe5248 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingChannel.cs
@@ -44,6 +44,11 @@ namespace DotNetOpenAuth.Test.Mocks {
this.VerifyMessageAfterReceiving(CloneSerializedParts(message));
}
+ internal void PostMessage(IProtocolMessage message) {
+ this.incomingMessage = CloneSerializedParts(message);
+ this.incomingMessageSignal.Set();
+ }
+
protected internal override HttpRequestInfo GetRequestFromContext() {
return new HttpRequestInfo((IDirectedProtocolMessage)this.AwaitIncomingMessage());
}
@@ -62,9 +67,7 @@ namespace DotNetOpenAuth.Test.Mocks {
protected override UserAgentResponse SendDirectMessageResponse(IProtocolMessage response) {
this.ProcessMessageFilter(response, true);
- this.RemoteChannel.incomingMessage = CloneSerializedParts(response);
- this.RemoteChannel.incomingMessageSignal.Set();
- return null;
+ return new CoordinatingUserAgentResponse(CloneSerializedParts(response), this.RemoteChannel);
}
protected override UserAgentResponse SendIndirectMessage(IDirectedProtocolMessage message) {
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs
new file mode 100644
index 0000000..4897e98
--- /dev/null
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingUserAgentResponse.cs
@@ -0,0 +1,29 @@
+//-----------------------------------------------------------------------
+// <copyright file="CoordinatingUserAgentResponse.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.Test.Mocks {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using DotNetOpenAuth.Messaging;
+
+ internal class CoordinatingUserAgentResponse : UserAgentResponse {
+ private CoordinatingChannel receivingChannel;
+
+ internal CoordinatingUserAgentResponse(IProtocolMessage message, CoordinatingChannel receivingChannel) {
+ ErrorUtilities.VerifyArgumentNotNull(message, "message");
+ ErrorUtilities.VerifyArgumentNotNull(receivingChannel, "receivingChannel");
+
+ this.receivingChannel = receivingChannel;
+ this.OriginalMessage = message;
+ }
+
+ public override void Send() {
+ this.receivingChannel.PostMessage(this.OriginalMessage);
+ }
+ }
+}