summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OpenId
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/OpenId')
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs37
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs2
2 files changed, 37 insertions, 2 deletions
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
index 3f8ff22..0fcb750 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
@@ -6,9 +6,8 @@
namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using System;
- using System.Collections.Generic;
using System.Linq;
- using System.Text;
+ using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
@@ -31,5 +30,39 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
var rp = new OpenIdRelyingParty(new AssociationMemoryStore<Uri>(), new NonceMemoryStore(TimeSpan.FromMinutes(5)), new PrivateSecretMemoryStore());
rp.SecuritySettings = null;
}
+
+ [TestMethod]
+ public void CreateRequest() {
+ var rp = this.CreateRelyingParty();
+ rp.AssociationStore.StoreAssociation(TestSupport.GetFullUrl("/" + TestSupport.ProviderPage), HmacShaAssociation.Create("somehandle", new byte[20], TimeSpan.FromDays(1)));
+ Identifier id = Identifier.Parse(GetMockIdentifier(TestSupport.Scenarios.AutoApproval, ProtocolVersion.V20));
+ var req = rp.CreateRequest(id, TestSupport.Realm, TestSupport.ReturnTo);
+ Assert.IsNotNull(req);
+ }
+
+ [TestMethod]
+ public void CreateRequests() {
+ var rp = this.CreateRelyingParty();
+ rp.AssociationStore.StoreAssociation(TestSupport.GetFullUrl("/" + TestSupport.ProviderPage), HmacShaAssociation.Create("somehandle", new byte[20], TimeSpan.FromDays(1)));
+ Identifier id = Identifier.Parse(GetMockIdentifier(TestSupport.Scenarios.AutoApproval, ProtocolVersion.V20));
+ var requests = rp.CreateRequests(id, TestSupport.Realm, TestSupport.ReturnTo);
+ Assert.AreEqual(1, requests.Count());
+ }
+ [TestMethod, ExpectedException(typeof(ProtocolException))]
+ public void CreateRequestOnNonOpenID() {
+ Uri nonOpenId = new Uri("http://www.microsoft.com/");
+ var rp = this.CreateRelyingParty();
+ this.MockResponder.RegisterMockResponse(nonOpenId, "text/html", "<html/>");
+ rp.CreateRequest(nonOpenId, TestSupport.Realm, TestSupport.ReturnTo);
+ }
+
+ [TestMethod]
+ public void CreateRequestsOnNonOpenID() {
+ Uri nonOpenId = new Uri("http://www.microsoft.com/");
+ var rp = this.CreateRelyingParty();
+ this.MockResponder.RegisterMockResponse(nonOpenId, "text/html", "<html/>");
+ var requests = rp.CreateRequests(nonOpenId, TestSupport.Realm, TestSupport.ReturnTo);
+ Assert.AreEqual(0, requests.Count());
+ }
}
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs
index 7ebd0a9..b3812ce 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAuthenticationResponseTests.cs
@@ -40,6 +40,8 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
Assert.AreEqual<string>(authResponseAccessor.endpoint.FriendlyIdentifierForDisplay, authResponse.FriendlyIdentifierForDisplay);
Assert.AreSame(extension, authResponse.GetExtension(typeof(ClaimsResponse)));
Assert.AreSame(extension, authResponse.GetExtension<ClaimsResponse>());
+ Assert.IsNull(authResponse.GetCallbackArgument("a"));
+ Assert.AreEqual(0, authResponse.GetCallbackArguments().Count);
}
/// <summary>