summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test')
-rw-r--r--src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs10
-rw-r--r--src/DotNetOpenAuth.Test/Hosting/HttpHost.cs26
-rw-r--r--src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs24
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs79
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs32
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs6
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs11
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/TestSupport.cs73
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs72
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs8
-rw-r--r--src/DotNetOpenAuth.Test/Settings.StyleCop10
11 files changed, 206 insertions, 145 deletions
diff --git a/src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs b/src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs
index 015a00b..94bf480 100644
--- a/src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs
+++ b/src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs
@@ -22,13 +22,13 @@ namespace DotNetOpenAuth.Test.Hosting {
private HttpHost httpHost;
public AspNetHost() {
- httpHost = HttpHost.CreateHost(this);
+ this.httpHost = HttpHost.CreateHost(this);
////if (!UntrustedWebRequestHandler.WhitelistHosts.Contains("localhost"))
//// UntrustedWebRequestHandler.WhitelistHosts.Add("localhost");
}
public Uri BaseUri {
- get { return httpHost.BaseUri; }
+ get { return this.httpHost.BaseUri; }
}
public static AspNetHost CreateHost(string webDirectory) {
@@ -38,11 +38,11 @@ namespace DotNetOpenAuth.Test.Hosting {
}
public string ProcessRequest(string url) {
- return httpHost.ProcessRequest(url);
+ return this.httpHost.ProcessRequest(url);
}
public string ProcessRequest(string url, string body) {
- return httpHost.ProcessRequest(url, body);
+ return this.httpHost.ProcessRequest(url, body);
}
public void BeginProcessRequest(HttpListenerContext context) {
@@ -61,7 +61,7 @@ namespace DotNetOpenAuth.Test.Hosting {
}
public void CloseHttp() {
- httpHost.Dispose();
+ this.httpHost.Dispose();
}
}
}
diff --git a/src/DotNetOpenAuth.Test/Hosting/HttpHost.cs b/src/DotNetOpenAuth.Test/Hosting/HttpHost.cs
index 06001ce..3ccd8bc 100644
--- a/src/DotNetOpenAuth.Test/Hosting/HttpHost.cs
+++ b/src/DotNetOpenAuth.Test/Hosting/HttpHost.cs
@@ -11,7 +11,7 @@ namespace DotNetOpenAuth.Test.Hosting {
using System.Net;
using System.Threading;
- class HttpHost : IDisposable {
+ internal class HttpHost : IDisposable {
private HttpListener listener;
private Thread listenerThread;
private AspNetHost aspNetHost;
@@ -33,12 +33,16 @@ namespace DotNetOpenAuth.Test.Hosting {
}
throw;
}
- this.listenerThread = new Thread(ProcessRequests);
+ this.listenerThread = new Thread(this.ProcessRequests);
this.listenerThread.Start();
}
public int Port { get; private set; }
+ public Uri BaseUri {
+ get { return new Uri("http://localhost:" + this.Port.ToString() + "/"); }
+ }
+
public static HttpHost CreateHost(AspNetHost aspNetHost) {
return new HttpHost(aspNetHost);
}
@@ -46,17 +50,13 @@ namespace DotNetOpenAuth.Test.Hosting {
public static HttpHost CreateHost(string webDirectory) {
return new HttpHost(AspNetHost.CreateHost(webDirectory));
}
-
- public Uri BaseUri {
- get { return new Uri("http://localhost:" + this.Port.ToString() + "/"); }
- }
-
+
public string ProcessRequest(string url) {
- return ProcessRequest(url, null);
+ return this.ProcessRequest(url, null);
}
-
+
public string ProcessRequest(string url, string body) {
- WebRequest request = WebRequest.Create(new Uri(BaseUri, url));
+ WebRequest request = WebRequest.Create(new Uri(this.BaseUri, url));
if (body != null) {
request.Method = "POST";
request.ContentLength = body.Length;
@@ -81,9 +81,9 @@ namespace DotNetOpenAuth.Test.Hosting {
#region IDisposable Members
public void Dispose() {
- listener.Close();
- listenerThread.Join(1000);
- listenerThread.Abort();
+ this.listener.Close();
+ this.listenerThread.Join(1000);
+ this.listenerThread.Abort();
}
#endregion
diff --git a/src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs b/src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs
index 6d1ee8d..d059c36 100644
--- a/src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs
+++ b/src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs
@@ -12,7 +12,9 @@ namespace DotNetOpenAuth.Test.Hosting {
internal class TestingWorkerRequest : SimpleWorkerRequest {
private Stream entityStream;
+
private HttpListenerContext context;
+
private TextWriter writer;
public TestingWorkerRequest(string page, string query, Stream entityStream, TextWriter writer)
@@ -20,6 +22,7 @@ namespace DotNetOpenAuth.Test.Hosting {
this.entityStream = entityStream;
this.writer = writer;
}
+
public TestingWorkerRequest(HttpListenerContext context, TextWriter output)
: base(context.Request.Url.LocalPath.TrimStart('/'), context.Request.Url.Query, output) {
this.entityStream = context.Request.InputStream;
@@ -29,66 +32,85 @@ namespace DotNetOpenAuth.Test.Hosting {
public override string GetFilePath() {
string filePath = this.context.Request.Url.LocalPath.Replace("/", "\\");
- if (filePath.EndsWith("\\", StringComparison.Ordinal))
+ if (filePath.EndsWith("\\", StringComparison.Ordinal)) {
filePath += "default.aspx";
+ }
return filePath;
}
+
public override int GetLocalPort() {
return this.context.Request.Url.Port;
}
+
public override string GetServerName() {
return this.context.Request.Url.Host;
}
+
public override string GetQueryString() {
return this.context.Request.Url.Query.TrimStart('?');
}
+
public override string GetHttpVerbName() {
return this.context.Request.HttpMethod;
}
+
public override string GetLocalAddress() {
return this.context.Request.LocalEndPoint.Address.ToString();
}
+
public override string GetHttpVersion() {
return "HTTP/1.1";
}
+
public override string GetProtocol() {
return this.context.Request.Url.Scheme;
}
+
public override string GetRawUrl() {
return this.context.Request.RawUrl;
}
+
public override int GetTotalEntityBodyLength() {
return (int)this.context.Request.ContentLength64;
}
+
public override string GetKnownRequestHeader(int index) {
return this.context.Request.Headers[GetKnownRequestHeaderName(index)];
}
+
public override string GetUnknownRequestHeader(string name) {
return this.context.Request.Headers[name];
}
+
public override bool IsEntireEntityBodyIsPreloaded() {
return false;
}
+
public override int ReadEntityBody(byte[] buffer, int size) {
return this.entityStream.Read(buffer, 0, size);
}
+
public override int ReadEntityBody(byte[] buffer, int offset, int size) {
return this.entityStream.Read(buffer, offset, size);
}
+
public override void SendCalculatedContentLength(int contentLength) {
this.context.Response.ContentLength64 = contentLength;
}
+
public override void SendStatus(int statusCode, string statusDescription) {
if (this.context != null) {
this.context.Response.StatusCode = statusCode;
this.context.Response.StatusDescription = statusDescription;
}
}
+
public override void SendKnownResponseHeader(int index, string value) {
if (this.context != null) {
this.context.Response.Headers[(HttpResponseHeader)index] = value;
}
}
+
public override void SendUnknownResponseHeader(string name, string value) {
if (this.context != null) {
this.context.Response.Headers[name] = value;
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs
index 08e4473..94d6f81 100644
--- a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs
@@ -1,4 +1,10 @@
-namespace DotNetOpenAuth.Test.Mocks {
+//-----------------------------------------------------------------------
+// <copyright file="MockHttpRequest.cs" company="Andrew Arnott">
+// Copyright (c) Andrew Arnott. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -6,15 +12,22 @@
using System.Net;
using System.Text;
using System.Web;
- using DotNetOpenAuth.OpenId.RelyingParty;
- using DotNetOpenAuth.Yadis;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
+ using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.OpenId;
+ using DotNetOpenAuth.Yadis;
internal class MockHttpRequest {
private readonly Dictionary<Uri, DirectWebResponse> registeredMockResponses = new Dictionary<Uri, DirectWebResponse>();
+ private MockHttpRequest(IDirectSslWebRequestHandler mockHandler) {
+ ErrorUtilities.VerifyArgumentNotNull(mockHandler, "mockHandler");
+ this.MockWebRequestHandler = mockHandler;
+ }
+
+ internal IDirectSslWebRequestHandler MockWebRequestHandler { get; private set; }
+
internal static MockHttpRequest CreateUntrustedMockHttpHandler() {
TestWebRequestHandler testHandler = new TestWebRequestHandler();
UntrustedWebRequestHandler untrustedHandler = new UntrustedWebRequestHandler(testHandler);
@@ -26,33 +39,31 @@
return mock;
}
- internal IDirectSslWebRequestHandler MockWebRequestHandler { get; private set; }
-
internal void RegisterMockResponse(DirectWebResponse response) {
- if (response == null) throw new ArgumentNullException("response");
- if (registeredMockResponses.ContainsKey(response.RequestUri)) {
+ ErrorUtilities.VerifyArgumentNotNull(response, "response");
+ if (this.registeredMockResponses.ContainsKey(response.RequestUri)) {
Logger.WarnFormat("Mock HTTP response already registered for {0}.", response.RequestUri);
} else {
- registeredMockResponses.Add(response.RequestUri, response);
+ this.registeredMockResponses.Add(response.RequestUri, response);
}
}
internal void RegisterMockResponse(Uri requestUri, string contentType, string responseBody) {
- RegisterMockResponse(requestUri, requestUri, contentType, responseBody);
+ this.RegisterMockResponse(requestUri, requestUri, contentType, responseBody);
}
internal void RegisterMockResponse(Uri requestUri, Uri responseUri, string contentType, string responseBody) {
- RegisterMockResponse(requestUri, responseUri, contentType, new WebHeaderCollection(), responseBody);
+ this.RegisterMockResponse(requestUri, responseUri, contentType, new WebHeaderCollection(), responseBody);
}
internal void RegisterMockResponse(Uri requestUri, Uri responseUri, string contentType, WebHeaderCollection headers, string responseBody) {
- if (requestUri == null) throw new ArgumentNullException("requestUri");
- if (responseUri == null) throw new ArgumentNullException("responseUri");
- if (String.IsNullOrEmpty(contentType)) throw new ArgumentNullException("contentType");
+ ErrorUtilities.VerifyArgumentNotNull(requestUri, "requestUri");
+ ErrorUtilities.VerifyArgumentNotNull(responseUri, "responseUri");
+ ErrorUtilities.VerifyNonZeroLength(contentType, "contentType");
// Set up the redirect if appropriate
if (requestUri != responseUri) {
- RegisterMockRedirect(requestUri, responseUri);
+ this.RegisterMockRedirect(requestUri, responseUri);
}
string contentEncoding = null;
@@ -61,18 +72,17 @@
sw.Write(responseBody);
sw.Flush();
stream.Seek(0, SeekOrigin.Begin);
- RegisterMockResponse(new DirectWebResponse(responseUri, responseUri, headers ?? new WebHeaderCollection(),
- HttpStatusCode.OK, contentType, contentEncoding, stream));
+ this.RegisterMockResponse(new DirectWebResponse(responseUri, responseUri, headers ?? new WebHeaderCollection(), HttpStatusCode.OK, contentType, contentEncoding, stream));
}
internal void RegisterMockXrdsResponses(IDictionary<string, string> requestUriAndResponseBody) {
foreach (var pair in requestUriAndResponseBody) {
- RegisterMockResponse(new Uri(pair.Key), "text/xml; saml=false; https=false; charset=UTF-8", pair.Value);
+ this.RegisterMockResponse(new Uri(pair.Key), "text/xml; saml=false; https=false; charset=UTF-8", pair.Value);
}
}
internal void RegisterMockXrdsResponse(ServiceEndpoint endpoint) {
- if (endpoint == null) throw new ArgumentNullException("endpoint");
+ ErrorUtilities.VerifyArgumentNotNull(endpoint, "endpoint");
string identityUri;
if (endpoint.ClaimedIdentifier == endpoint.Protocol.ClaimedIdentifierForOPIdentifier) {
@@ -80,11 +90,11 @@
} else {
identityUri = endpoint.UserSuppliedIdentifier ?? endpoint.ClaimedIdentifier;
}
- RegisterMockXrdsResponse(new Uri(identityUri), new ServiceEndpoint[] { endpoint });
+ this.RegisterMockXrdsResponse(new Uri(identityUri), new ServiceEndpoint[] { endpoint });
}
internal void RegisterMockXrdsResponse(Uri respondingUri, IEnumerable<ServiceEndpoint> endpoints) {
- if (endpoints == null) throw new ArgumentNullException("endpoints");
+ ErrorUtilities.VerifyArgumentNotNull(endpoints, "endpoints");
StringBuilder xrds = new StringBuilder();
xrds.AppendLine(@"<xrds:XRDS xmlns:xrds='xri://$xrds' xmlns:openid='http://openid.net/xmlns/1.0' xmlns='xri://$xrd*($v*2.0)'>
@@ -103,7 +113,9 @@
} else {
serviceTypeUri = endpoint.Protocol.ClaimedIdentifierServiceTypeURI;
}
- string xrd = string.Format(CultureInfo.InvariantCulture, template,
+ string xrd = string.Format(
+ CultureInfo.InvariantCulture,
+ template,
HttpUtility.HtmlEncode(serviceTypeUri),
HttpUtility.HtmlEncode(endpoint.ProviderEndpoint.AbsoluteUri),
HttpUtility.HtmlEncode(endpoint.ProviderLocalIdentifier));
@@ -113,7 +125,7 @@
</XRD>
</xrds:XRDS>");
- RegisterMockResponse(respondingUri, ContentTypes.Xrds, xrds.ToString());
+ this.RegisterMockResponse(respondingUri, ContentTypes.Xrds, xrds.ToString());
}
internal void RegisterMockXrdsResponse(UriIdentifier directedIdentityAssignedIdentifier, ServiceEndpoint providerEndpoint) {
@@ -124,12 +136,12 @@
new string[] { providerEndpoint.Protocol.ClaimedIdentifierServiceTypeURI },
10,
10);
- RegisterMockXrdsResponse(identityEndpoint);
+ this.RegisterMockXrdsResponse(identityEndpoint);
}
internal Identifier RegisterMockXrdsResponse(string embeddedResourcePath) {
UriIdentifier id = TestSupport.GetFullUrl(embeddedResourcePath);
- RegisterMockResponse(id, "application/xrds+xml", TestSupport.LoadEmbeddedFile(embeddedResourcePath));
+ this.RegisterMockResponse(id, "application/xrds+xml", TestSupport.LoadEmbeddedFile(embeddedResourcePath));
return id;
}
@@ -144,11 +156,9 @@
</Service>
</XRD>
</xrds:XRDS>";
- string xrds = string.Format(CultureInfo.InvariantCulture, template,
- HttpUtility.HtmlEncode(Protocol.V20.RPReturnToTypeURI),
- HttpUtility.HtmlEncode(rpRealmUri.AbsoluteUri));
+ string xrds = string.Format(CultureInfo.InvariantCulture, template, HttpUtility.HtmlEncode(Protocol.V20.RPReturnToTypeURI), HttpUtility.HtmlEncode(rpRealmUri.AbsoluteUri));
- RegisterMockResponse(rpRealmUri, ContentTypes.Xrds, xrds);
+ this.RegisterMockResponse(rpRealmUri, ContentTypes.Xrds, xrds);
}
internal void DeleteResponse(Uri requestUri) {
@@ -159,14 +169,8 @@
var redirectionHeaders = new WebHeaderCollection {
{ HttpResponseHeader.Location, redirectLocation.AbsoluteUri },
};
- DirectWebResponse response = new DirectWebResponse(origin, origin,
- redirectionHeaders, HttpStatusCode.Redirect, null, null, new MemoryStream());
- RegisterMockResponse(response);
- }
-
- private MockHttpRequest(IDirectSslWebRequestHandler mockHandler) {
- ErrorUtilities.VerifyArgumentNotNull(mockHandler, "mockHandler");
- this.MockWebRequestHandler = mockHandler;
+ DirectWebResponse response = new DirectWebResponse(origin, origin, redirectionHeaders, HttpStatusCode.Redirect, null, null, new MemoryStream());
+ this.RegisterMockResponse(response);
}
private DirectWebResponse GetMockResponse(HttpWebRequest request) {
@@ -178,8 +182,7 @@
} else {
////Assert.Fail("Unexpected HTTP request: {0}", uri);
Logger.WarnFormat("Unexpected HTTP request: {0}", request.RequestUri);
- return new DirectWebResponse(request.RequestUri, request.RequestUri, new WebHeaderCollection(), HttpStatusCode.NotFound,
- "text/html", null, new MemoryStream());
+ return new DirectWebResponse(request.RequestUri, request.RequestUri, new WebHeaderCollection(), HttpStatusCode.NotFound, "text/html", null, new MemoryStream());
}
}
}
diff --git a/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs b/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs
index 007a1d6..782ba2b 100644
--- a/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/MockIdentifier.cs
@@ -7,9 +7,9 @@
namespace DotNetOpenAuth.Test.Mocks {
using System;
using System.Collections.Generic;
- using DotNetOpenAuth.OpenId.RelyingParty;
+ using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
-using DotNetOpenAuth.Messaging;
+ using DotNetOpenAuth.OpenId.RelyingParty;
/// <summary>
/// Performs similar to an ordinary <see cref="Identifier"/>, but when called upon
@@ -18,7 +18,9 @@ using DotNetOpenAuth.Messaging;
/// </summary>
internal class MockIdentifier : Identifier {
private IEnumerable<ServiceEndpoint> endpoints;
+
private MockHttpRequest mockHttpRequest;
+
private Identifier wrappedIdentifier;
public MockIdentifier(Identifier wrappedIdentifier, MockHttpRequest mockHttpRequest, IEnumerable<ServiceEndpoint> endpoints)
@@ -36,6 +38,18 @@ using DotNetOpenAuth.Messaging;
mockHttpRequest.RegisterMockXrdsResponse(new Uri(wrappedIdentifier.ToString()), endpoints);
}
+ public override string ToString() {
+ return this.wrappedIdentifier.ToString();
+ }
+
+ public override bool Equals(object obj) {
+ return this.wrappedIdentifier.Equals(obj);
+ }
+
+ public override int GetHashCode() {
+ return this.wrappedIdentifier.GetHashCode();
+ }
+
internal override IEnumerable<ServiceEndpoint> Discover(IDirectSslWebRequestHandler requestHandler) {
return this.endpoints;
}
@@ -48,21 +62,9 @@ using DotNetOpenAuth.Messaging;
// We take special care to make our wrapped identifier secure, but still
// return a mocked (secure) identifier.
Identifier secureWrappedIdentifier;
- bool result = wrappedIdentifier.TryRequireSsl(out secureWrappedIdentifier);
+ bool result = this.wrappedIdentifier.TryRequireSsl(out secureWrappedIdentifier);
secureIdentifier = new MockIdentifier(secureWrappedIdentifier, this.mockHttpRequest, this.endpoints);
return result;
}
-
- public override string ToString() {
- return this.wrappedIdentifier.ToString();
- }
-
- public override bool Equals(object obj) {
- return this.wrappedIdentifier.Equals(obj);
- }
-
- public override int GetHashCode() {
- return this.wrappedIdentifier.GetHashCode();
- }
}
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs b/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
index 7bc60c7..2b012dd 100644
--- a/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
@@ -50,11 +50,11 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.IsInstanceOfType(id, typeof(UriIdentifier));
Assert.AreEqual(this.uri, ((UriIdentifier)id).Uri.AbsoluteUri);
// verify an HTTPS Uri
- id = Identifier.Parse(uriHttps);
+ id = Identifier.Parse(this.uriHttps);
Assert.IsInstanceOfType(id, typeof(UriIdentifier));
- Assert.AreEqual(uriHttps, ((UriIdentifier)id).Uri.AbsoluteUri);
+ Assert.AreEqual(this.uriHttps, ((UriIdentifier)id).Uri.AbsoluteUri);
// verify that if the scheme is missing it is added automatically
- id = Identifier.Parse(uriNoScheme);
+ id = Identifier.Parse(this.uriNoScheme);
Assert.IsInstanceOfType(id, typeof(UriIdentifier));
Assert.AreEqual(this.uri, ((UriIdentifier)id).Uri.AbsoluteUri);
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs b/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs
index 7deafef..be795c3 100644
--- a/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs
@@ -13,13 +13,14 @@ namespace DotNetOpenAuth.Test.OpenId {
using Microsoft.VisualStudio.TestTools.UnitTesting;
public class OpenIdTestBase : TestBase {
+ internal IDirectSslWebRequestHandler RequestHandler;
+
+ internal MockHttpRequest MockResponder;
+
protected RelyingPartySecuritySettings RelyingPartySecuritySettings { get; private set; }
protected ProviderSecuritySettings ProviderSecuritySettings { get; private set; }
- internal IDirectSslWebRequestHandler requestHandler;
- internal MockHttpRequest mockResponder;
-
[TestInitialize]
public override void SetUp() {
base.SetUp();
@@ -27,8 +28,8 @@ namespace DotNetOpenAuth.Test.OpenId {
this.RelyingPartySecuritySettings = RelyingPartySection.Configuration.SecuritySettings.CreateSecuritySettings();
this.ProviderSecuritySettings = ProviderSection.Configuration.SecuritySettings.CreateSecuritySettings();
- this.mockResponder = MockHttpRequest.CreateUntrustedMockHttpHandler();
- this.requestHandler = this.mockResponder.MockWebRequestHandler;
+ this.MockResponder = MockHttpRequest.CreateUntrustedMockHttpHandler();
+ this.RequestHandler = this.MockResponder.MockWebRequestHandler;
}
}
}
diff --git a/src/DotNetOpenAuth.Test/OpenId/TestSupport.cs b/src/DotNetOpenAuth.Test/OpenId/TestSupport.cs
index 4470b99..665c041 100644
--- a/src/DotNetOpenAuth.Test/OpenId/TestSupport.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/TestSupport.cs
@@ -14,63 +14,80 @@ namespace DotNetOpenAuth.Test.OpenId {
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.RelyingParty;
using DotNetOpenAuth.Test.Mocks;
- //using DotNetOpenAuth.Test.UI;
+ ////using DotNetOpenAuth.Test.UI;
using log4net;
public class TestSupport {
- public static readonly string TestWebDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\src\DotNetOpenId.TestWeb"));
public const string HostTestPage = "HostTest.aspx";
+
public const string ProviderPage = "ProviderEndpoint.aspx";
+
public const string DirectedProviderEndpoint = "DirectedProviderEndpoint.aspx";
+
public const string MobileConsumerPage = "RelyingPartyMobile.aspx";
+
public const string ConsumerPage = "RelyingParty.aspx";
+
public const string OPDefaultPage = "OPDefault.aspx";
- public static Uri ReturnTo {
- get { return TestSupport.GetFullUrl(TestSupport.ConsumerPage); }
- }
- public static Realm Realm {
- get { return new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri); }
- }
- public readonly static ILog Logger = LogManager.GetLogger("DotNetOpenId.Test");
+
+ public static readonly ILog Logger = LogManager.GetLogger("DotNetOpenId.Test");
+
+ public static readonly string TestWebDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\src\DotNetOpenId.TestWeb"));
+
private const string IdentityPage = "IdentityEndpoint.aspx";
+
private const string DirectedIdentityPage = "DirectedIdentityEndpoint.aspx";
public enum Scenarios {
// Authentication test scenarios
AutoApproval,
+
AutoApprovalAddFragment,
+
ApproveOnSetup,
+
AlwaysDeny,
- // Extension test scenarios
+ /* Extension test scenarios */
+
/// <summary>
/// Provides all required and requested fields.
/// </summary>
ExtensionFullCooperation,
+
/// <summary>
/// Provides only those fields marked as required.
/// </summary>
ExtensionPartialCooperation,
}
+ public static Uri ReturnTo {
+ get { return TestSupport.GetFullUrl(TestSupport.ConsumerPage); }
+ }
+
+ public static Realm Realm {
+ get { return new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri); }
+ }
+
public static Identifier GetDelegateUrl(Scenarios scenario) {
return GetDelegateUrl(scenario, false);
}
-
+
public static Identifier GetDelegateUrl(Scenarios scenario, bool useSsl) {
return new UriIdentifier(GetFullUrl("/" + scenario, null, useSsl));
}
-
+
public static Uri GetFullUrl(string url) {
return GetFullUrl(url, null, false);
}
-
+
public static Uri GetFullUrl(string url, string key, object value) {
- return GetFullUrl(url, new Dictionary<string, string> {
- { key, value.ToString() },
- }, false);
+ var dictionary = new Dictionary<string, string> {
+ { key, value.ToString() },
+ };
+ return GetFullUrl(url, dictionary, false);
}
-
+
public static Uri GetFullUrl(string url, IDictionary<string, string> args, bool useSsl) {
Uri defaultUriBase = new Uri(useSsl ? "https://localhost/" : "http://localhost/");
Uri baseUri = UITestSupport.Host != null ? UITestSupport.Host.BaseUri : defaultUriBase;
@@ -84,8 +101,11 @@ namespace DotNetOpenAuth.Test.OpenId {
/// </summary>
/// <param name="path">The path of the file as it appears within the project,
/// where the leading / marks the root directory of the project.</param>
+ /// <returns>The content of the requested resource.</returns>
internal static string LoadEmbeddedFile(string path) {
- if (!path.StartsWith("/")) path = "/" + path;
+ if (!path.StartsWith("/")) {
+ path = "/" + path;
+ }
path = "DotNetOpenAuth.Test.OpenId" + path.Replace('/', '.');
Stream resource = Assembly.GetExecutingAssembly().GetManifestResourceStream(path);
if (resource == null) {
@@ -105,23 +125,24 @@ namespace DotNetOpenAuth.Test.OpenId {
internal static UriIdentifier GetIdentityUrl(Scenarios scenario, ProtocolVersion providerVersion) {
return GetIdentityUrl(scenario, providerVersion, false);
}
-
+
internal static UriIdentifier GetIdentityUrl(Scenarios scenario, ProtocolVersion providerVersion, bool useSsl) {
- return new UriIdentifier(GetFullUrl("/" + IdentityPage, new Dictionary<string, string> {
- { "user", scenario.ToString() },
- { "version", providerVersion.ToString() },
- }, useSsl));
+ var dictionary = new Dictionary<string, string> {
+ { "user", scenario.ToString() },
+ { "version", providerVersion.ToString() },
+ };
+ return new UriIdentifier(GetFullUrl("/" + IdentityPage, dictionary, useSsl));
}
-
+
internal static MockIdentifier GetMockIdentifier(Scenarios scenario, MockHttpRequest mockRequest, ProtocolVersion providerVersion) {
return GetMockIdentifier(scenario, mockRequest, providerVersion, false);
}
-
+
internal static MockIdentifier GetMockIdentifier(Scenarios scenario, MockHttpRequest mockRequest, ProtocolVersion providerVersion, bool useSsl) {
ServiceEndpoint se = GetServiceEndpoint(scenario, providerVersion, 10, useSsl);
return new MockIdentifier(GetIdentityUrl(scenario, providerVersion, useSsl), mockRequest, new ServiceEndpoint[] { se });
}
-
+
internal static ServiceEndpoint GetServiceEndpoint(Scenarios scenario, ProtocolVersion providerVersion, int servicePriority, bool useSsl) {
return ServiceEndpoint.CreateForClaimedIdentifier(
GetIdentityUrl(scenario, providerVersion, useSsl),
diff --git a/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs b/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs
index 1dfb173..f4433f0 100644
--- a/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs
@@ -103,7 +103,7 @@ namespace DotNetOpenAuth.Test.OpenId {
public void IsValid() {
Assert.IsTrue(UriIdentifier.IsValidUri(this.goodUri));
Assert.IsFalse(UriIdentifier.IsValidUri(this.badUri));
- Assert.IsTrue(UriIdentifier.IsValidUri(relativeUri), "URL lacking http:// prefix should have worked anyway.");
+ Assert.IsTrue(UriIdentifier.IsValidUri(this.relativeUri), "URL lacking http:// prefix should have worked anyway.");
}
[TestMethod]
@@ -161,8 +161,7 @@ namespace DotNetOpenAuth.Test.OpenId {
[TestMethod]
public void XrdsDiscoveryFromHead() {
- this.mockResponder.RegisterMockResponse(new Uri("http://localhost/xrds1020.xml"),
- "application/xrds+xml", TestSupport.LoadEmbeddedFile("/Discovery/xrdsdiscovery/xrds1020.xml"));
+ this.MockResponder.RegisterMockResponse(new Uri("http://localhost/xrds1020.xml"), "application/xrds+xml", TestSupport.LoadEmbeddedFile("/Discovery/xrdsdiscovery/xrds1020.xml"));
this.DiscoverXrds("XrdsReferencedInHead.html", ProtocolVersion.V10, null);
}
@@ -170,7 +169,7 @@ namespace DotNetOpenAuth.Test.OpenId {
public void XrdsDiscoveryFromHttpHeader() {
WebHeaderCollection headers = new WebHeaderCollection();
headers.Add("X-XRDS-Location", TestSupport.GetFullUrl("http://localhost/xrds1020.xml").AbsoluteUri);
- this.mockResponder.RegisterMockResponse(new Uri("http://localhost/xrds1020.xml"), "application/xrds+xml", TestSupport.LoadEmbeddedFile("/Discovery/xrdsdiscovery/xrds1020.xml"));
+ this.MockResponder.RegisterMockResponse(new Uri("http://localhost/xrds1020.xml"), "application/xrds+xml", TestSupport.LoadEmbeddedFile("/Discovery/xrdsdiscovery/xrds1020.xml"));
this.DiscoverXrds("XrdsReferencedInHttpHeader.html", ProtocolVersion.V10, null, headers);
}
@@ -215,17 +214,17 @@ namespace DotNetOpenAuth.Test.OpenId {
[TestMethod]
public void DiscoveryWithRedirects() {
- Identifier claimedId = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.mockResponder, ProtocolVersion.V20);
+ Identifier claimedId = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.MockResponder, ProtocolVersion.V20);
// Add a couple of chained redirect pages that lead to the claimedId.
Uri userSuppliedUri = TestSupport.GetFullUrl("/someSecurePage", null, true);
Uri insecureMidpointUri = TestSupport.GetFullUrl("/insecureStop");
- this.mockResponder.RegisterMockRedirect(userSuppliedUri, insecureMidpointUri);
- this.mockResponder.RegisterMockRedirect(insecureMidpointUri, new Uri(claimedId.ToString()));
+ this.MockResponder.RegisterMockRedirect(userSuppliedUri, insecureMidpointUri);
+ this.MockResponder.RegisterMockRedirect(insecureMidpointUri, new Uri(claimedId.ToString()));
// don't require secure SSL discovery for this test.
Identifier userSuppliedIdentifier = new UriIdentifier(userSuppliedUri, false);
- Assert.AreEqual(1, userSuppliedIdentifier.Discover(this.requestHandler).Count());
+ Assert.AreEqual(1, userSuppliedIdentifier.Discover(this.RequestHandler).Count());
}
[TestMethod]
@@ -249,80 +248,81 @@ namespace DotNetOpenAuth.Test.OpenId {
Assert.IsFalse(id.TryRequireSsl(out secureId));
Assert.IsFalse(secureId.IsDiscoverySecureEndToEnd);
Assert.AreEqual("http://www.yahoo.com/", secureId.ToString());
- Assert.AreEqual(0, secureId.Discover(this.requestHandler).Count());
+ Assert.AreEqual(0, secureId.Discover(this.RequestHandler).Count());
id = new UriIdentifier("http://www.yahoo.com");
Assert.IsFalse(id.TryRequireSsl(out secureId));
Assert.IsFalse(secureId.IsDiscoverySecureEndToEnd);
Assert.AreEqual("http://www.yahoo.com/", secureId.ToString());
- Assert.AreEqual(0, secureId.Discover(this.requestHandler).Count());
+ Assert.AreEqual(0, secureId.Discover(this.RequestHandler).Count());
}
[TestMethod]
public void DiscoverRequireSslWithSecureRedirects() {
- Identifier claimedId = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.mockResponder, ProtocolVersion.V20, true);
+ Identifier claimedId = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.MockResponder, ProtocolVersion.V20, true);
// Add a couple of chained redirect pages that lead to the claimedId.
// All redirects should be secure.
Uri userSuppliedUri = TestSupport.GetFullUrl("/someSecurePage", null, true);
Uri secureMidpointUri = TestSupport.GetFullUrl("/secureStop", null, true);
- this.mockResponder.RegisterMockRedirect(userSuppliedUri, secureMidpointUri);
- this.mockResponder.RegisterMockRedirect(secureMidpointUri, new Uri(claimedId.ToString()));
+ this.MockResponder.RegisterMockRedirect(userSuppliedUri, secureMidpointUri);
+ this.MockResponder.RegisterMockRedirect(secureMidpointUri, new Uri(claimedId.ToString()));
Identifier userSuppliedIdentifier = new UriIdentifier(userSuppliedUri, true);
- Assert.AreEqual(1, userSuppliedIdentifier.Discover(this.requestHandler).Count());
+ Assert.AreEqual(1, userSuppliedIdentifier.Discover(this.RequestHandler).Count());
}
[TestMethod, ExpectedException(typeof(ProtocolException))]
public void DiscoverRequireSslWithInsecureRedirect() {
- Identifier claimedId = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.mockResponder, ProtocolVersion.V20, true);
+ Identifier claimedId = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.MockResponder, ProtocolVersion.V20, true);
// Add a couple of chained redirect pages that lead to the claimedId.
// Include an insecure HTTP jump in those redirects to verify that
// the ultimate endpoint is never found as a result of high security profile.
Uri userSuppliedUri = TestSupport.GetFullUrl("/someSecurePage", null, true);
Uri insecureMidpointUri = TestSupport.GetFullUrl("/insecureStop");
- this.mockResponder.RegisterMockRedirect(userSuppliedUri, insecureMidpointUri);
- this.mockResponder.RegisterMockRedirect(insecureMidpointUri, new Uri(claimedId.ToString()));
+ this.MockResponder.RegisterMockRedirect(userSuppliedUri, insecureMidpointUri);
+ this.MockResponder.RegisterMockRedirect(insecureMidpointUri, new Uri(claimedId.ToString()));
Identifier userSuppliedIdentifier = new UriIdentifier(userSuppliedUri, true);
- userSuppliedIdentifier.Discover(this.requestHandler);
+ userSuppliedIdentifier.Discover(this.RequestHandler);
}
[TestMethod]
public void DiscoveryRequireSslWithInsecureXrdsInSecureHtmlHead() {
- var insecureXrdsSource = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.mockResponder, ProtocolVersion.V20, false);
+ var insecureXrdsSource = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.MockResponder, ProtocolVersion.V20, false);
Uri secureClaimedUri = TestSupport.GetFullUrl("/secureId", null, true);
string html = string.Format("<html><head><meta http-equiv='X-XRDS-Location' content='{0}'/></head><body></body></html>", insecureXrdsSource);
- this.mockResponder.RegisterMockResponse(secureClaimedUri, "text/html", html);
+ this.MockResponder.RegisterMockResponse(secureClaimedUri, "text/html", html);
Identifier userSuppliedIdentifier = new UriIdentifier(secureClaimedUri, true);
- Assert.AreEqual(0, userSuppliedIdentifier.Discover(this.requestHandler).Count());
+ Assert.AreEqual(0, userSuppliedIdentifier.Discover(this.RequestHandler).Count());
}
[TestMethod]
public void DiscoveryRequireSslWithInsecureXrdsInSecureHttpHeader() {
- var insecureXrdsSource = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.mockResponder, ProtocolVersion.V20, false);
+ var insecureXrdsSource = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.MockResponder, ProtocolVersion.V20, false);
Uri secureClaimedUri = TestSupport.GetFullUrl("/secureId", null, true);
string html = "<html><head></head><body></body></html>";
WebHeaderCollection headers = new WebHeaderCollection {
{ "X-XRDS-Location", insecureXrdsSource }
};
- this.mockResponder.RegisterMockResponse(secureClaimedUri, secureClaimedUri, "text/html", headers, html);
+ this.MockResponder.RegisterMockResponse(secureClaimedUri, secureClaimedUri, "text/html", headers, html);
Identifier userSuppliedIdentifier = new UriIdentifier(secureClaimedUri, true);
- Assert.AreEqual(0, userSuppliedIdentifier.Discover(this.requestHandler).Count());
+ Assert.AreEqual(0, userSuppliedIdentifier.Discover(this.RequestHandler).Count());
}
[TestMethod]
public void DiscoveryRequireSslWithInsecureXrdsButSecureLinkTags() {
- var insecureXrdsSource = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.mockResponder, ProtocolVersion.V20, false);
+ var insecureXrdsSource = TestSupport.GetMockIdentifier(TestSupport.Scenarios.AutoApproval, this.MockResponder, ProtocolVersion.V20, false);
Uri secureClaimedUri = TestSupport.GetFullUrl("/secureId", null, true);
Identifier localIdForLinkTag = TestSupport.GetDelegateUrl(TestSupport.Scenarios.AlwaysDeny, true);
- string html = string.Format(@"
+ string html = string.Format(
+ @"
<html><head>
<meta http-equiv='X-XRDS-Location' content='{0}'/> <!-- this one will be insecure and ignored -->
<link rel='openid2.provider' href='{1}' />
@@ -331,10 +331,10 @@ namespace DotNetOpenAuth.Test.OpenId {
HttpUtility.HtmlEncode(insecureXrdsSource),
HttpUtility.HtmlEncode(TestSupport.GetFullUrl("/" + TestSupport.ProviderPage, null, true).AbsoluteUri),
HttpUtility.HtmlEncode(localIdForLinkTag.ToString()));
- this.mockResponder.RegisterMockResponse(secureClaimedUri, "text/html", html);
+ this.MockResponder.RegisterMockResponse(secureClaimedUri, "text/html", html);
Identifier userSuppliedIdentifier = new UriIdentifier(secureClaimedUri, true);
- Assert.AreEqual(localIdForLinkTag, userSuppliedIdentifier.Discover(this.requestHandler).Single().ProviderLocalIdentifier);
+ Assert.AreEqual(localIdForLinkTag, userSuppliedIdentifier.Discover(this.RequestHandler).Single().ProviderLocalIdentifier);
}
[TestMethod]
@@ -342,8 +342,8 @@ namespace DotNetOpenAuth.Test.OpenId {
var insecureEndpoint = TestSupport.GetServiceEndpoint(TestSupport.Scenarios.AutoApproval, ProtocolVersion.V20, 10, false);
var secureEndpoint = TestSupport.GetServiceEndpoint(TestSupport.Scenarios.ApproveOnSetup, ProtocolVersion.V20, 20, true);
UriIdentifier secureClaimedId = new UriIdentifier(TestSupport.GetFullUrl("/claimedId", null, true), true);
- this.mockResponder.RegisterMockXrdsResponse(secureClaimedId, new ServiceEndpoint[] { insecureEndpoint, secureEndpoint });
- Assert.AreEqual(secureEndpoint.ProviderLocalIdentifier, secureClaimedId.Discover(this.requestHandler).Single().ProviderLocalIdentifier);
+ this.MockResponder.RegisterMockXrdsResponse(secureClaimedId, new ServiceEndpoint[] { insecureEndpoint, secureEndpoint });
+ Assert.AreEqual(secureEndpoint.ProviderLocalIdentifier, secureClaimedId.Discover(this.RequestHandler).Single().ProviderLocalIdentifier);
}
private void Discover(string url, ProtocolVersion version, Identifier expectedLocalId, bool expectSreg, bool useRedirect) {
@@ -368,9 +368,9 @@ namespace DotNetOpenAuth.Test.OpenId {
} else {
throw new InvalidOperationException();
}
- this.mockResponder.RegisterMockResponse(new Uri(idToDiscover), claimedId, contentType, headers ?? new WebHeaderCollection(), TestSupport.LoadEmbeddedFile(url));
+ this.MockResponder.RegisterMockResponse(new Uri(idToDiscover), claimedId, contentType, headers ?? new WebHeaderCollection(), TestSupport.LoadEmbeddedFile(url));
- ServiceEndpoint se = idToDiscover.Discover(this.requestHandler).FirstOrDefault();
+ ServiceEndpoint se = idToDiscover.Discover(this.RequestHandler).FirstOrDefault();
Assert.IsNotNull(se, url + " failed to be discovered.");
Assert.AreSame(protocol, se.Protocol);
Assert.AreEqual(claimedId, se.ClaimedIdentifier);
@@ -387,7 +387,9 @@ namespace DotNetOpenAuth.Test.OpenId {
}
private void DiscoverXrds(string page, ProtocolVersion version, Identifier expectedLocalId, WebHeaderCollection headers) {
- if (!page.Contains(".")) page += ".xml";
+ if (!page.Contains(".")) {
+ page += ".xml";
+ }
this.Discover("/Discovery/xrdsdiscovery/" + page, version, expectedLocalId, true, false, headers);
this.Discover("/Discovery/xrdsdiscovery/" + page, version, expectedLocalId, true, true, headers);
}
@@ -405,9 +407,9 @@ namespace DotNetOpenAuth.Test.OpenId {
private void FailDiscover(string url) {
UriIdentifier userSuppliedId = TestSupport.GetFullUrl(url);
- this.mockResponder.RegisterMockResponse(new Uri(userSuppliedId), userSuppliedId, "text/html", TestSupport.LoadEmbeddedFile(url));
+ this.MockResponder.RegisterMockResponse(new Uri(userSuppliedId), userSuppliedId, "text/html", TestSupport.LoadEmbeddedFile(url));
- Assert.AreEqual(0, userSuppliedId.Discover(this.requestHandler).Count()); // ... but that no endpoint info is discoverable
+ Assert.AreEqual(0, userSuppliedId.Discover(this.RequestHandler).Count()); // ... but that no endpoint info is discoverable
}
private void FailDiscoverHtml(string scenario) {
diff --git a/src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs b/src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs
index 4d349ff..b6b2e55 100644
--- a/src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/XriIdentifierTests.cs
@@ -125,7 +125,7 @@ namespace DotNetOpenAuth.Test.OpenId {
{ "https://xri.net/=Arnott?_xrd_r=application/xrd%2Bxml;sep=false", xrds },
{ "https://xri.net/=!9B72.7DD1.50A9.5CCD?_xrd_r=application/xrd%2Bxml;sep=false", xrds },
};
- this.mockResponder.RegisterMockXrdsResponses(mocks);
+ this.MockResponder.RegisterMockXrdsResponses(mocks);
string expectedCanonicalId = "=!9B72.7DD1.50A9.5CCD";
ServiceEndpoint se = this.VerifyCanonicalId("=Arnott", expectedCanonicalId);
@@ -351,7 +351,7 @@ uEyb50RJ7DWmXctSC0b3eymZ2lSXxAWNOsNy
</X509Data>
</KeyInfo>
</XRD>";
- this.mockResponder.RegisterMockXrdsResponses(new Dictionary<string, string> {
+ this.MockResponder.RegisterMockXrdsResponses(new Dictionary<string, string> {
{ "https://xri.net/@llli?_xrd_r=application/xrd%2Bxml;sep=false", llliResponse },
{ "https://xri.net/@llli*area?_xrd_r=application/xrd%2Bxml;sep=false", llliAreaResponse },
{ "https://xri.net/@llli*area*canada.unattached?_xrd_r=application/xrd%2Bxml;sep=false", llliAreaCanadaUnattachedResponse },
@@ -367,7 +367,7 @@ uEyb50RJ7DWmXctSC0b3eymZ2lSXxAWNOsNy
[TestMethod]
public void DiscoveryCommunityInameDelegateWithoutCanonicalID() {
- this.mockResponder.RegisterMockXrdsResponses(new Dictionary<string, string> {
+ this.MockResponder.RegisterMockXrdsResponses(new Dictionary<string, string> {
{ "https://xri.net/=Web*andrew.arnott?_xrd_r=application/xrd%2Bxml;sep=false", @"<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='xri://$xrd*($v*2.0)'>
<Query>*andrew.arnott</Query>
@@ -459,7 +459,7 @@ uEyb50RJ7DWmXctSC0b3eymZ2lSXxAWNOsNy
}
private ServiceEndpoint VerifyCanonicalId(Identifier iname, string expectedClaimedIdentifier) {
- ServiceEndpoint se = iname.Discover(this.requestHandler).FirstOrDefault();
+ ServiceEndpoint se = iname.Discover(this.RequestHandler).FirstOrDefault();
if (expectedClaimedIdentifier != null) {
Assert.IsNotNull(se);
Assert.AreEqual(expectedClaimedIdentifier, se.ClaimedIdentifier.ToString(), "i-name {0} discovery resulted in unexpected CanonicalId", iname);
diff --git a/src/DotNetOpenAuth.Test/Settings.StyleCop b/src/DotNetOpenAuth.Test/Settings.StyleCop
index d7b9e54..d8cb897 100644
--- a/src/DotNetOpenAuth.Test/Settings.StyleCop
+++ b/src/DotNetOpenAuth.Test/Settings.StyleCop
@@ -33,5 +33,15 @@
</CollectionProperty>
</AnalyzerSettings>
</Analyzer>
+ <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.MaintainabilityRules">
+ <Rules>
+ <Rule Name="FieldsMustBePrivate">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
</Analyzers>
</StyleCopSettings> \ No newline at end of file