diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-21 10:21:10 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-21 10:21:10 -0800 |
commit | 4fc95a91caf2caa216a5080f151e24ad1d6fcba4 (patch) | |
tree | 2024ba45599cb8ef9b92d8e652d6dae4f7057e92 /src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs | |
parent | d7c4c22f7a35d884c0f0c1f8fb0b517b7f68f54b (diff) | |
download | DotNetOpenAuth-4fc95a91caf2caa216a5080f151e24ad1d6fcba4.zip DotNetOpenAuth-4fc95a91caf2caa216a5080f151e24ad1d6fcba4.tar.gz DotNetOpenAuth-4fc95a91caf2caa216a5080f151e24ad1d6fcba4.tar.bz2 |
Added two more OAuth2 unit tests, for the UserAgentClient class.
Diffstat (limited to 'src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs b/src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs index 5af7fe8..993cad5 100644 --- a/src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs +++ b/src/DotNetOpenAuth.Test/OAuth2/OAuth2Coordinator.cs @@ -12,34 +12,43 @@ namespace DotNetOpenAuth.Test.OAuth2 { using DotNetOpenAuth.OAuth2; using DotNetOpenAuth.Test.Mocks; - internal class OAuth2Coordinator : CoordinatorBase<WebServerClient, AuthorizationServer> { + internal class OAuth2Coordinator<TClient> : CoordinatorBase<TClient, AuthorizationServer> + where TClient : ClientBase { private readonly AuthorizationServerDescription serverDescription; private readonly IAuthorizationServer authServerHost; + private readonly TClient client; - internal OAuth2Coordinator(AuthorizationServerDescription serverDescription, IAuthorizationServer authServerHost, Action<WebServerClient> clientAction, Action<AuthorizationServer> authServerAction) + internal OAuth2Coordinator( + AuthorizationServerDescription serverDescription, + IAuthorizationServer authServerHost, + TClient client, + Action<TClient> clientAction, + Action<AuthorizationServer> authServerAction) : base(clientAction, authServerAction) { Requires.NotNull(serverDescription, "serverDescription"); Requires.NotNull(authServerHost, "authServerHost"); + Requires.NotNull(client, "client"); + this.serverDescription = serverDescription; this.authServerHost = authServerHost; + this.client = client; + + this.client.ClientIdentifier = OAuth2TestBase.ClientId; + this.client.ClientSecret = OAuth2TestBase.ClientSecret; } internal override void Run() { - var client = new WebServerClient(this.serverDescription) { - ClientIdentifier = OAuth2TestBase.ClientId, - ClientSecret = OAuth2TestBase.ClientSecret, - }; var authServer = new AuthorizationServer(this.authServerHost); - var rpCoordinatingChannel = new CoordinatingChannel(client.Channel, this.IncomingMessageFilter, this.OutgoingMessageFilter); + var rpCoordinatingChannel = new CoordinatingChannel(this.client.Channel, this.IncomingMessageFilter, this.OutgoingMessageFilter); var opCoordinatingChannel = new CoordinatingOAuth2AuthServerChannel(authServer.Channel, this.IncomingMessageFilter, this.OutgoingMessageFilter); rpCoordinatingChannel.RemoteChannel = opCoordinatingChannel; opCoordinatingChannel.RemoteChannel = rpCoordinatingChannel; - client.Channel = rpCoordinatingChannel; + this.client.Channel = rpCoordinatingChannel; authServer.Channel = opCoordinatingChannel; - this.RunCore(client, authServer); + this.RunCore(this.client, authServer); } private static Action<WebServerClient> WrapAction(Action<WebServerClient> action) { |