summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId.Test
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenId.Test')
-rw-r--r--src/DotNetOpenId.Test/Extensions/AttributeExchangeTests.cs15
-rw-r--r--src/DotNetOpenId.Test/ExtensionsArgumentsManagerTests.cs10
2 files changed, 21 insertions, 4 deletions
diff --git a/src/DotNetOpenId.Test/Extensions/AttributeExchangeTests.cs b/src/DotNetOpenId.Test/Extensions/AttributeExchangeTests.cs
index f9c769e..7ed6699 100644
--- a/src/DotNetOpenId.Test/Extensions/AttributeExchangeTests.cs
+++ b/src/DotNetOpenId.Test/Extensions/AttributeExchangeTests.cs
@@ -88,5 +88,20 @@ namespace DotNetOpenId.Test.Extensions {
for (int i = 0; i < newAttribute.Values.Length; i++)
Assert.AreEqual(newAttribute.Values[i], att.Values[i]);
}
+
+ /// <summary>
+ /// Tests that two extensions that use the same namespace cannot
+ /// both be added to the message at once, per the spec.
+ /// </summary>
+ [Test, ExpectedException(typeof(OpenIdException))]
+ public void FetchAndStore() {
+ var identityUrl = TestSupport.GetIdentityUrl(TestSupport.Scenarios.ExtensionFullCooperation, Version);
+ var returnTo = TestSupport.GetFullUrl(TestSupport.ConsumerPage);
+ var realm = new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri);
+ var consumer = new OpenIdRelyingParty(AppStore, null);
+ var request = consumer.CreateRequest(identityUrl, realm, returnTo);
+ request.AddExtension(new AttributeExchangeFetchRequest());
+ request.AddExtension(new AttributeExchangeStoreRequest());
+ }
}
}
diff --git a/src/DotNetOpenId.Test/ExtensionsArgumentsManagerTests.cs b/src/DotNetOpenId.Test/ExtensionsArgumentsManagerTests.cs
index 91f8682..3fcbb3c 100644
--- a/src/DotNetOpenId.Test/ExtensionsArgumentsManagerTests.cs
+++ b/src/DotNetOpenId.Test/ExtensionsArgumentsManagerTests.cs
@@ -167,8 +167,12 @@ namespace DotNetOpenId.Test {
ExtensionArgumentsManager.CreateIncomingExtensions(args);
}
- [Test]
- public void AddExtensionArgsTwice() {
+ /// <summary>
+ /// Verifies that two extensions cannot be added in the same namespace
+ /// to the same message.
+ /// </summary>
+ [Test, ExpectedException(typeof(OpenIdException))]
+ public void AddExtensionArgsTwiceInSameNamespace() {
var args1 = new Dictionary<string, string>() {
{"k1", "v1"},
};
@@ -178,8 +182,6 @@ namespace DotNetOpenId.Test {
var mgr = ExtensionArgumentsManager.CreateOutgoingExtensions(protocol);
mgr.AddExtensionArguments("extTypeURI", args1);
mgr.AddExtensionArguments("extTypeURI", args2);
- var results = mgr.GetArgumentsToSend(false);
- Assert.AreEqual(3, results.Count);
}
[Test]