diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-20 22:37:31 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-02-20 22:37:31 -0800 |
commit | 9e448e402eda0b9d372d857d2e17a4b21962afec (patch) | |
tree | 285aa4478cfd5307b9ade1d0989a999fe5db28ce /src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs | |
parent | cff5a6286292111821fe082755c7b1c1c89d3231 (diff) | |
download | DotNetOpenAuth-9e448e402eda0b9d372d857d2e17a4b21962afec.zip DotNetOpenAuth-9e448e402eda0b9d372d857d2e17a4b21962afec.tar.gz DotNetOpenAuth-9e448e402eda0b9d372d857d2e17a4b21962afec.tar.bz2 |
Moved some test code around.
Diffstat (limited to 'src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs | 14 |
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; + } } } |