summaryrefslogtreecommitdiffstats
path: root/src/DotNetOAuth.Test
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-09-30 07:42:12 -0700
committerAndrew <andrewarnott@gmail.com>2008-10-02 07:33:57 -0700
commit08a2ca3fdbe337ba11575cf7893ab547536bb4e2 (patch)
tree450764d5a45091de0683d3f164a7efaa6164b22d /src/DotNetOAuth.Test
parent5cbd5d7edb994f874b265ed2e7c43f0bcd27b6ac (diff)
downloadDotNetOpenAuth-08a2ca3fdbe337ba11575cf7893ab547536bb4e2.zip
DotNetOpenAuth-08a2ca3fdbe337ba11575cf7893ab547536bb4e2.tar.gz
DotNetOpenAuth-08a2ca3fdbe337ba11575cf7893ab547536bb4e2.tar.bz2
Split up the two OAuth message type providers into Consumer and Service Provider classes so they could actually work correctly..
Added Try methods to read messages that might not be there without throwing exceptions.
Diffstat (limited to 'src/DotNetOAuth.Test')
-rw-r--r--src/DotNetOAuth.Test/ChannelElements/OAuthChannelTests.cs9
-rw-r--r--src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs4
-rw-r--r--src/DotNetOAuth.Test/Scenarios/Coordinator.cs4
3 files changed, 11 insertions, 6 deletions
diff --git a/src/DotNetOAuth.Test/ChannelElements/OAuthChannelTests.cs b/src/DotNetOAuth.Test/ChannelElements/OAuthChannelTests.cs
index 790a0d4..a5eebf2 100644
--- a/src/DotNetOAuth.Test/ChannelElements/OAuthChannelTests.cs
+++ b/src/DotNetOAuth.Test/ChannelElements/OAuthChannelTests.cs
@@ -52,8 +52,13 @@ namespace DotNetOAuth.Test.ChannelElements {
}
[TestMethod]
- public void CtorSimple() {
- new OAuthChannel(this.signingElement, this.nonceStore, new InMemoryTokenManager());
+ public void CtorSimpleConsumer() {
+ new OAuthChannel(this.signingElement, this.nonceStore, new InMemoryTokenManager(), true);
+ }
+
+ [TestMethod]
+ public void CtorSimpleServiceProvider() {
+ new OAuthChannel(this.signingElement, this.nonceStore, new InMemoryTokenManager(), false);
}
[TestMethod]
diff --git a/src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs b/src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs
index 5b74342..12974fd 100644
--- a/src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs
+++ b/src/DotNetOAuth.Test/Scenarios/CoordinatingOAuthChannel.cs
@@ -29,11 +29,11 @@ namespace DotNetOAuth.Test.Scenarios {
/// <param name="signingBindingElement">
/// The signing element for the Consumer to use. Null for the Service Provider.
/// </param>
- internal CoordinatingOAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement)
+ internal CoordinatingOAuthChannel(ITamperProtectionChannelBindingElement signingBindingElement, bool isConsumer)
: base(
signingBindingElement,
new NonceMemoryStore(StandardExpirationBindingElement.DefaultMaximumMessageAge),
- new OAuthMessageTypeProvider(new InMemoryTokenManager()),
+ isConsumer ? (IMessageTypeProvider)new OAuthConsumerMessageTypeProvider(new InMemoryTokenManager()) : new OAuthServiceProviderMessageTypeProvider(new InMemoryTokenManager()),
new TestWebRequestHandler()) {
}
diff --git a/src/DotNetOAuth.Test/Scenarios/Coordinator.cs b/src/DotNetOAuth.Test/Scenarios/Coordinator.cs
index ef0795e..ab270ce 100644
--- a/src/DotNetOAuth.Test/Scenarios/Coordinator.cs
+++ b/src/DotNetOAuth.Test/Scenarios/Coordinator.cs
@@ -51,8 +51,8 @@ namespace DotNetOAuth.Test.Scenarios {
}
// Prepare channels that will pass messages directly back and forth.
- CoordinatingOAuthChannel consumerChannel = new CoordinatingOAuthChannel(this.SigningElement);
- CoordinatingOAuthChannel serviceProviderChannel = new CoordinatingOAuthChannel(this.SigningElement);
+ CoordinatingOAuthChannel consumerChannel = new CoordinatingOAuthChannel(this.SigningElement, true);
+ CoordinatingOAuthChannel serviceProviderChannel = new CoordinatingOAuthChannel(this.SigningElement, false);
consumerChannel.RemoteChannel = serviceProviderChannel;
serviceProviderChannel.RemoteChannel = consumerChannel;