summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-02-25 12:50:30 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-02-25 12:50:30 -0800
commitd03e08372ad96d7d2d32535839640e18331fc2a2 (patch)
tree5d066c787cb26a560afd2d00b6c38822fa66fc7a /src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
parent977904a485d85d2f409d75fcd53361bf565b0c98 (diff)
downloadDotNetOpenAuth-d03e08372ad96d7d2d32535839640e18331fc2a2.zip
DotNetOpenAuth-d03e08372ad96d7d2d32535839640e18331fc2a2.tar.gz
DotNetOpenAuth-d03e08372ad96d7d2d32535839640e18331fc2a2.tar.bz2
Added scopes to the tested authorization flows.
Diffstat (limited to 'src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs')
-rw-r--r--src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs b/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
index 1b5c329..87d91f7 100644
--- a/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
+++ b/src/DotNetOpenAuth.Test/OAuth2/OAuth2TestBase.cs
@@ -9,6 +9,7 @@ namespace DotNetOpenAuth.Test.OAuth2 {
using System.Collections.Generic;
using System.Linq;
using System.Text;
+ using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OAuth2;
using DotNetOpenAuth.OAuth2.ChannelElements;
@@ -23,6 +24,8 @@ namespace DotNetOpenAuth.Test.OAuth2 {
protected const string ResourceOwnerPassword = "TestUserPassword";
+ protected static readonly string[] TestScopes = new[] { "Scope1", "Scope2" };
+
protected static readonly Uri ClientCallback = new Uri("http://client/callback");
protected static readonly AuthorizationServerDescription AuthorizationServerDescription = new AuthorizationServerDescription {
@@ -42,7 +45,13 @@ namespace DotNetOpenAuth.Test.OAuth2 {
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 == ResourceOwnerUsername))).Returns(true);
+ authHostMock.Setup(
+ m =>
+ m.IsAuthorizationValid(
+ It.Is<IAuthorizationDescription>(
+ d =>
+ d.ClientIdentifier == ClientId && d.User == ResourceOwnerUsername &&
+ MessagingUtilities.AreEquivalent(d.Scope, TestScopes)))).Returns(true);
authHostMock.Setup(m => m.IsResourceOwnerCredentialValid(ResourceOwnerUsername, ResourceOwnerPassword)).Returns(true);
return authHostMock;
}