summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs')
-rw-r--r--src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs b/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
index 32de525..cefab0f 100644
--- a/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
+++ b/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
@@ -9,7 +9,10 @@ namespace DotNetOpenAuth.Test.OAuth2 {
using System.Collections.Generic;
using System.Linq;
using System.Text;
+ using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OAuth2;
+ using DotNetOpenAuth.OAuth2.ChannelElements;
+ using Moq;
public class OAuth2TestBase : TestBase {
protected internal const string ClientId = "TestClientId";
@@ -29,5 +32,16 @@ namespace DotNetOpenAuth.Test.OAuth2 {
ClientSecret,
ClientCallback,
ClientType.Confidential);
+
+ protected static readonly IAuthorizationServer AuthorizationServerMock = CreateAuthorizationServerMock().Object;
+
+ protected static Mock<IAuthorizationServer> CreateAuthorizationServerMock() {
+ var authHostMock = new Mock<IAuthorizationServer>();
+ var cryptoStore = new MemoryCryptoKeyStore();
+ authHostMock.Setup(m => m.GetClient(ClientId)).Returns(ClientDescription);
+ authHostMock.SetupGet(m => m.CryptoKeyStore).Returns(cryptoStore);
+ authHostMock.Setup(m => m.IsAuthorizationValid(It.Is<IAuthorizationDescription>(d => d.ClientIdentifier == ClientId && d.User == Username))).Returns(true);
+ return authHostMock;
+ }
}
}