summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/Mocks/MockIdentifierDiscoveryService.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-11-18 21:55:12 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2009-11-18 21:56:12 -0800
commit90b81ab271bd0d0fd1396c062504bdc75a02a809 (patch)
treeba50662e79fa56fa98e46a9e2cce40686c19b963 /src/DotNetOpenAuth.Test/Mocks/MockIdentifierDiscoveryService.cs
parent2d7d1dd7b86e6c4c7fdeac97901e82c83199823a (diff)
downloadDotNetOpenAuth-90b81ab271bd0d0fd1396c062504bdc75a02a809.zip
DotNetOpenAuth-90b81ab271bd0d0fd1396c062504bdc75a02a809.tar.gz
DotNetOpenAuth-90b81ab271bd0d0fd1396c062504bdc75a02a809.tar.bz2
Updated tests to build with new extensible identifier discovery.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Mocks/MockIdentifierDiscoveryService.cs')
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockIdentifierDiscoveryService.cs48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockIdentifierDiscoveryService.cs b/src/DotNetOpenAuth.Test/Mocks/MockIdentifierDiscoveryService.cs
new file mode 100644
index 0000000..e02fa1f
--- /dev/null
+++ b/src/DotNetOpenAuth.Test/Mocks/MockIdentifierDiscoveryService.cs
@@ -0,0 +1,48 @@
+//-----------------------------------------------------------------------
+// <copyright file="MockIdentifierDiscoveryService.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.Test.Mocks {
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.DiscoveryServices;
+ using DotNetOpenAuth.OpenId.RelyingParty;
+
+ internal class MockIdentifierDiscoveryService : IIdentifierDiscoveryService {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MockIdentifierDiscoveryService"/> class.
+ /// </summary>
+ public MockIdentifierDiscoveryService() {
+ }
+
+ #region IIdentifierDiscoveryService Members
+
+ /// <summary>
+ /// Performs discovery on the specified identifier.
+ /// </summary>
+ /// <param name="identifier">The identifier to perform discovery on.</param>
+ /// <param name="requestHandler">The means to place outgoing HTTP requests.</param>
+ /// <param name="abortDiscoveryChain">if set to <c>true</c>, no further discovery services will be called for this identifier.</param>
+ /// <returns>
+ /// A sequence of service endpoints yielded by discovery. Must not be null, but may be empty.
+ /// </returns>
+ public IEnumerable<ServiceEndpoint> Discover(Identifier identifier, IDirectWebRequestHandler requestHandler, out bool abortDiscoveryChain) {
+ var mockIdentifier = identifier as MockIdentifier;
+ if (mockIdentifier == null) {
+ abortDiscoveryChain = false;
+ return Enumerable.Empty<ServiceEndpoint>();
+ }
+
+ abortDiscoveryChain = true;
+ return mockIdentifier.DiscoveryEndpoints;
+ }
+
+ #endregion
+ }
+}