summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-15 17:07:03 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-15 17:07:03 -0700
commitef1c63fc17bd5ae7eda4444ded592574d437d309 (patch)
treef9101be9ffc1bffe79221097e3e1e4600128b9c2 /src/DotNetOpenAuth.Test
parent217ac4c345ff523715c638f2869ac5cb1b4eb195 (diff)
parentc925ab3d2c5697c9f5f6e57aa58a042f49cf8ecd (diff)
downloadDotNetOpenAuth-ef1c63fc17bd5ae7eda4444ded592574d437d309.zip
DotNetOpenAuth-ef1c63fc17bd5ae7eda4444ded592574d437d309.tar.gz
DotNetOpenAuth-ef1c63fc17bd5ae7eda4444ded592574d437d309.tar.bz2
Merge branch 'v3.0'
Diffstat (limited to 'src/DotNetOpenAuth.Test')
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs3
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockOpenIdExtension.cs2
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs12
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs12
6 files changed, 29 insertions, 12 deletions
diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs
index f611552..2e5a9ce 100644
--- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs
@@ -40,6 +40,9 @@ namespace DotNetOpenAuth.Test.Mocks {
/// <param name="recipient">The recipient.</param>
internal CoordinatingHttpRequestInfo(MessageReceivingEndpoint recipient) {
this.recipient = recipient;
+ if (recipient != null) {
+ this.Url = recipient.Location;
+ }
if (recipient == null || (recipient.AllowedMethods & HttpDeliveryMethods.GetRequest) != 0) {
this.HttpMethod = "GET";
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockOpenIdExtension.cs b/src/DotNetOpenAuth.Test/Mocks/MockOpenIdExtension.cs
index 86b77bc..f9d418f 100644
--- a/src/DotNetOpenAuth.Test/Mocks/MockOpenIdExtension.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/MockOpenIdExtension.cs
@@ -15,7 +15,7 @@ namespace DotNetOpenAuth.Test.Mocks {
internal class MockOpenIdExtension : IOpenIdMessageExtension {
internal const string MockTypeUri = "http://mockextension";
- internal static readonly OpenIdExtensionFactory.CreateDelegate Factory = (typeUri, data, baseMessage) => {
+ internal static readonly StandardOpenIdExtensionFactory.CreateDelegate Factory = (typeUri, data, baseMessage, isProviderRole) => {
if (typeUri == MockTypeUri) {
return new MockOpenIdExtension();
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
index 24c62e1..5af1caf 100644
--- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/ExtensionsBindingElementTests.cs
@@ -21,7 +21,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
[TestClass]
public class ExtensionsBindingElementTests : OpenIdTestBase {
- private OpenIdExtensionFactory factory;
+ private StandardOpenIdExtensionFactory factory;
private ExtensionsBindingElement rpElement;
private IProtocolMessageWithExtensions request;
@@ -29,7 +29,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
public override void SetUp() {
base.SetUp();
- this.factory = new OpenIdExtensionFactory();
+ this.factory = new StandardOpenIdExtensionFactory();
this.factory.RegisterExtension(MockOpenIdExtension.Factory);
this.rpElement = new ExtensionsBindingElement(this.factory, new RelyingPartySecuritySettings());
this.rpElement.Channel = new TestChannel(this.MessageDescriptions);
@@ -169,7 +169,7 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements {
private static void RegisterMockExtension(Channel channel) {
ErrorUtilities.VerifyArgumentNotNull(channel, "channel");
- ((OpenIdExtensionFactory)channel.BindingElements.OfType<ExtensionsBindingElement>().Single().ExtensionFactory).RegisterExtension(MockOpenIdExtension.Factory);
+ ExtensionTestUtilities.RegisterExtension(channel, MockOpenIdExtension.Factory);
}
/// <summary>
diff --git a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs
index 7792ad9..47c8ec4 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Extensions/ExtensionTestUtilities.cs
@@ -70,11 +70,11 @@ namespace DotNetOpenAuth.Test.OpenId.Extensions {
coordinator.Run();
}
- internal static void RegisterExtension(Channel channel, OpenIdExtensionFactory.CreateDelegate extensionFactory) {
+ internal static void RegisterExtension(Channel channel, StandardOpenIdExtensionFactory.CreateDelegate extensionFactory) {
ErrorUtilities.VerifyArgumentNotNull(channel, "channel");
- OpenIdExtensionFactory factory = (OpenIdExtensionFactory)channel.BindingElements.OfType<ExtensionsBindingElement>().Single().ExtensionFactory;
- factory.RegisterExtension(extensionFactory);
+ var factory = (OpenIdExtensionFactoryAggregator)channel.BindingElements.OfType<ExtensionsBindingElement>().Single().ExtensionFactory;
+ factory.Factories.OfType<StandardOpenIdExtensionFactory>().Single().RegisterExtension(extensionFactory);
}
}
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs b/src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs
index f1994d1..76a46d0 100644
--- a/src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/Provider/OpenIdProviderTests.cs
@@ -6,11 +6,9 @@
namespace DotNetOpenAuth.Test.OpenId.Provider {
using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.Extensions;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.Provider;
using DotNetOpenAuth.OpenId.RelyingParty;
@@ -54,6 +52,14 @@ namespace DotNetOpenAuth.Test.OpenId.Provider {
Assert.AreSame(newSettings, this.provider.SecuritySettings);
}
+ [TestMethod]
+ public void ExtensionFactories() {
+ var factories = this.provider.ExtensionFactories;
+ Assert.IsNotNull(factories);
+ Assert.AreEqual(1, factories.Count);
+ Assert.IsInstanceOfType(factories[0], typeof(StandardOpenIdExtensionFactory));
+ }
+
/// <summary>
/// Verifies the Channel property.
/// </summary>
diff --git a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
index d2a75de..68bbff3 100644
--- a/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/RelyingParty/OpenIdRelyingPartyTests.cs
@@ -8,9 +8,8 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
using System;
using System.Linq;
using DotNetOpenAuth.Messaging;
- using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.OpenId;
- using DotNetOpenAuth.OpenId.ChannelElements;
+ using DotNetOpenAuth.OpenId.Extensions;
using DotNetOpenAuth.OpenId.Messages;
using DotNetOpenAuth.OpenId.RelyingParty;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -38,6 +37,15 @@ namespace DotNetOpenAuth.Test.OpenId.RelyingParty {
}
[TestMethod]
+ public void ExtensionFactories() {
+ var rp = new OpenIdRelyingParty(null);
+ var factories = rp.ExtensionFactories;
+ Assert.IsNotNull(factories);
+ Assert.AreEqual(1, factories.Count);
+ Assert.IsInstanceOfType(factories[0], typeof(StandardOpenIdExtensionFactory));
+ }
+
+ [TestMethod]
public void CreateRequest() {
var rp = this.CreateRelyingParty();
StoreAssociation(rp, OPUri, HmacShaAssociation.Create("somehandle", new byte[20], TimeSpan.FromDays(1)));