diff options
Diffstat (limited to 'src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs')
-rw-r--r-- | src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs b/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs new file mode 100644 index 0000000..002eee1 --- /dev/null +++ b/src/DotNetOAuth.Test/Mocks/InMemoryTokenManager.cs @@ -0,0 +1,37 @@ +namespace DotNetOAuth.Test.Mocks {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using DotNetOAuth.ChannelElements;
+
+ internal class InMemoryTokenManager : ITokenManager {
+ Dictionary<string, string> consumersAndSecrets = new Dictionary<string, string>();
+ Dictionary<string, string> tokensAndSecrets = new Dictionary<string, string>();
+
+ #region ITokenManager Members
+
+ public string GetConsumerSecret(string consumerKey) {
+ return consumersAndSecrets[consumerKey];
+ }
+
+ public string GetTokenSecret(string token) {
+ return tokensAndSecrets[token];
+ }
+
+ public void StoreNewRequestToken(string consumerKey, string requestToken, string requestTokenSecret, IDictionary<string, string> parameters) {
+ tokensAndSecrets[requestToken] = requestTokenSecret;
+ }
+
+ public void ExpireRequestTokenAndStoreNewAccessToken(string consumerKey, string requestToken, string accessToken, string accessTokenSecret) {
+ tokensAndSecrets.Remove(requestToken);
+ tokensAndSecrets[accessToken] = accessTokenSecret;
+ }
+
+ #endregion
+
+ internal void AddConsumer(string key, string secret) {
+ consumersAndSecrets.Add(key, secret);
+ }
+ }
+}
|