summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs')
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs
new file mode 100644
index 0000000..1418513
--- /dev/null
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/PositiveAnonymousResponseTests.cs
@@ -0,0 +1,56 @@
+//-----------------------------------------------------------------------
+// <copyright file="PositiveAnonymousResponseTests.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
+ using System;
+ using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.Extensions.SimpleRegistration;
+ using DotNetOpenAuth.OpenId.Messages;
+ using DotNetOpenAuth.OpenId.RelyingParty;
+ using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+ [TestClass]
+ public class PositiveAnonymousResponseTests : OpenIdTestBase {
+ private readonly Realm realm = new Realm("http://localhost/rp.aspx");
+ private readonly Uri returnTo = new Uri("http://localhost/rp.aspx");
+
+ [TestInitialize]
+ public override void SetUp() {
+ base.SetUp();
+ }
+
+ /// <summary>
+ /// Verifies that the Status property returns the correct value.
+ /// </summary>
+ [TestMethod]
+ public void CtorAndProperties() {
+ var responseMessage = new IndirectSignedResponse(Protocol.V20.Version, this.returnTo);
+ var ext = new ClaimsResponse();
+ responseMessage.Extensions.Add(ext);
+ var response = new PositiveAnonymousResponse(responseMessage);
+ Assert.AreEqual(AuthenticationStatus.ExtensionsOnly, response.Status);
+ Assert.AreSame(responseMessage, response.Response);
+ Assert.IsNull(response.ClaimedIdentifier);
+ Assert.IsNull(response.FriendlyIdentifierForDisplay);
+ Assert.IsNull(response.Exception);
+ Assert.IsNull(response.Provider);
+ Assert.AreSame(ext, response.GetUntrustedExtension<ClaimsResponse>());
+ }
+
+ /// <summary>
+ /// Verifies the Provider property.
+ /// </summary>
+ [TestMethod]
+ public void ProviderTest() {
+ var responseMessage = new IndirectSignedResponse(Protocol.V20.Version, this.returnTo);
+ responseMessage.ProviderEndpoint = OPUri;
+ var response = new PositiveAnonymousResponse(responseMessage);
+ Assert.IsNotNull(response.Provider);
+ Assert.AreEqual(OPUri, response.Provider.Uri);
+ Assert.AreEqual(responseMessage.Version, response.Provider.Version);
+ }
+ }
+}