diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-01-30 21:04:20 -0800 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2009-01-30 21:05:28 -0800 |
commit | e57dd7acc21239b0b8cc5e03298376570ffa8f5e (patch) | |
tree | f432320ff8e90c3fab1a902d8150ee8a093f11b8 /src | |
parent | 65fbd52b372c1322fc03ffbac79d3e1dd9ab102b (diff) | |
download | DotNetOpenAuth-e57dd7acc21239b0b8cc5e03298376570ffa8f5e.zip DotNetOpenAuth-e57dd7acc21239b0b8cc5e03298376570ffa8f5e.tar.gz DotNetOpenAuth-e57dd7acc21239b0b8cc5e03298376570ffa8f5e.tar.bz2 |
StyleCop fixes
Diffstat (limited to 'src')
10 files changed, 55 insertions, 48 deletions
diff --git a/src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs b/src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs index a61c0cf..08b7c18 100644 --- a/src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs +++ b/src/DotNetOpenAuth.Test/Hosting/AspNetHost.cs @@ -22,9 +22,12 @@ namespace DotNetOpenAuth.Test.Hosting { private HttpHost httpHost; /// <summary> + /// Initializes a new instance of the <see cref="AspNetHost"/> class. + /// </summary> + /// <remarks> /// DO NOT CALL DIRECTLY. This is only here for ASP.NET to call. /// Call the static <see cref="AspNetHost.CreateHost"/> method instead. - /// </summary> + /// </remarks> [Obsolete("Use the CreateHost static method instead.")] public AspNetHost() { this.httpHost = HttpHost.CreateHost(this); @@ -78,7 +81,7 @@ namespace DotNetOpenAuth.Test.Hosting { protected void Dispose(bool disposing) { if (disposing) { - CloseHttp(); + this.CloseHttp(); } } diff --git a/src/DotNetOpenAuth.Test/Hosting/HostingTests.cs b/src/DotNetOpenAuth.Test/Hosting/HostingTests.cs index f65d081..ff72c66 100644 --- a/src/DotNetOpenAuth.Test/Hosting/HostingTests.cs +++ b/src/DotNetOpenAuth.Test/Hosting/HostingTests.cs @@ -7,12 +7,12 @@ namespace DotNetOpenAuth.Test.Hosting { using System; using System.Collections.Generic; + using System.IO; using System.Linq; - using System.Text; - using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Net; - using System.IO; + using System.Text; using DotNetOpenAuth.Test.OpenId; + using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public class HostingTests : TestBase { diff --git a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs index 5eae7b0..75f78ad 100644 --- a/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs +++ b/src/DotNetOpenAuth.Test/Mocks/MockHttpRequest.cs @@ -156,8 +156,8 @@ namespace DotNetOpenAuth.Test.Mocks { </XRD> </xrds:XRDS>"; string xrds = string.Format( - CultureInfo.InvariantCulture, - template, + CultureInfo.InvariantCulture, + template, HttpUtility.HtmlEncode(Protocol.V20.RPReturnToTypeURI), HttpUtility.HtmlEncode(OpenIdTestBase.RPRealmUri.AbsoluteUri)); diff --git a/src/DotNetOpenAuth.Test/Mocks/TestDirectResponseMessageWithHttpStatus.cs b/src/DotNetOpenAuth.Test/Mocks/TestDirectResponseMessageWithHttpStatus.cs index 1dd7444..d692320 100644 --- a/src/DotNetOpenAuth.Test/Mocks/TestDirectResponseMessageWithHttpStatus.cs +++ b/src/DotNetOpenAuth.Test/Mocks/TestDirectResponseMessageWithHttpStatus.cs @@ -1,4 +1,10 @@ -namespace DotNetOpenAuth.Test.Mocks { +//----------------------------------------------------------------------- +// <copyright file="TestDirectResponseMessageWithHttpStatus.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; @@ -15,7 +21,7 @@ #region IHttpDirectResponse Members /// <summary> - /// Gets the HTTP status code that the direct respones should be sent with. + /// Gets or sets the HTTP status code that the direct respones should be sent with. /// </summary> /// <value></value> public System.Net.HttpStatusCode HttpStatusCode { get; set; } diff --git a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs index fb725d4..fd901c1 100644 --- a/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs +++ b/src/DotNetOpenAuth.Test/OAuth/ChannelElements/OAuthChannelTests.cs @@ -154,6 +154,22 @@ namespace DotNetOpenAuth.Test.ChannelElements { this.ParameterizedRequestTest(HttpDeliveryMethods.PostRequest); } + /// <summary> + /// Verifies that messages asking for special HTTP status codes get them. + /// </summary> + [TestMethod] + public void SendDirectMessageResponseHonorsHttpStatusCodes() { + IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired); + UserAgentResponse directResponse = this.accessor.SendDirectMessageResponse(message); + Assert.AreEqual(HttpStatusCode.OK, directResponse.Status); + + var httpMessage = new TestDirectResponseMessageWithHttpStatus(); + MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired, httpMessage); + httpMessage.HttpStatusCode = HttpStatusCode.NotAcceptable; + directResponse = this.accessor.SendDirectMessageResponse(httpMessage); + Assert.AreEqual(HttpStatusCode.NotAcceptable, directResponse.Status); + } + private static string CreateAuthorizationHeader(IDictionary<string, string> fields) { if (fields == null) { throw new ArgumentNullException("fields"); @@ -278,21 +294,5 @@ namespace DotNetOpenAuth.Test.ChannelElements { Assert.AreEqual("Andrew", testMessage.Name); Assert.AreEqual("http://hostb/pathB", testMessage.Location.AbsoluteUri); } - - /// <summary> - /// Verifies that messages asking for special HTTP status codes get them. - /// </summary> - [TestMethod] - public void SendDirectMessageResponseHonorsHttpStatusCodes() { - IProtocolMessage message = MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired); - UserAgentResponse directResponse = this.accessor.SendDirectMessageResponse(message); - Assert.AreEqual(HttpStatusCode.OK, directResponse.Status); - - var httpMessage = new TestDirectResponseMessageWithHttpStatus(); - MessagingTestBase.GetStandardTestMessage(MessagingTestBase.FieldFill.AllRequired, httpMessage); - httpMessage.HttpStatusCode = HttpStatusCode.NotAcceptable; - directResponse = this.accessor.SendDirectMessageResponse(httpMessage); - Assert.AreEqual(HttpStatusCode.NotAcceptable, directResponse.Status); - } } } diff --git a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs index f22949e..d2ee73d 100644 --- a/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/ChannelElements/OpenIdChannelTests.cs @@ -17,8 +17,8 @@ namespace DotNetOpenAuth.Test.OpenId.ChannelElements { using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.ChannelElements; using DotNetOpenAuth.OpenId.RelyingParty; - using Microsoft.VisualStudio.TestTools.UnitTesting; using DotNetOpenAuth.Test.Mocks; + using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public class OpenIdChannelTests : TestBase { diff --git a/src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs b/src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs index 5b8b73f..afd3e0f 100644 --- a/src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/Messages/DirectErrorResponseTests.cs @@ -6,11 +6,11 @@ namespace DotNetOpenAuth.Test.OpenId.Messages { using System; + using System.Net; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.Messages; using Microsoft.VisualStudio.TestTools.UnitTesting; - using System.Net; [TestClass] public class DirectErrorResponseTests : OpenIdTestBase { diff --git a/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs b/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs index b12d4c9..6db5d1b 100644 --- a/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs +++ b/src/DotNetOpenAuth.Test/OpenId/OpenIdTestBase.cs @@ -6,6 +6,8 @@ namespace DotNetOpenAuth.Test.OpenId { using System; + using System.IO; + using System.Reflection; using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Bindings; @@ -14,15 +16,13 @@ namespace DotNetOpenAuth.Test.OpenId { using DotNetOpenAuth.OpenId.RelyingParty; using DotNetOpenAuth.Test.Mocks; using Microsoft.VisualStudio.TestTools.UnitTesting; - using System.Reflection; - using System.IO; public class OpenIdTestBase : TestBase { internal IDirectWebRequestHandler RequestHandler; internal MockHttpRequest MockResponder; - protected const string IdentifierSelect = "http://specs.openid.net/auth/2.0/identifier_select"; + protected internal const string IdentifierSelect = "http://specs.openid.net/auth/2.0/identifier_select"; protected internal static readonly Uri BaseMockUri = new Uri("http://localhost/"); protected internal static readonly Uri BaseMockUriSsl = new Uri("https://localhost/"); @@ -48,6 +48,15 @@ namespace DotNetOpenAuth.Test.OpenId { this.AutoProviderScenario = Scenarios.AutoApproval; } + public enum Scenarios { + AutoApproval, + AutoApprovalAddFragment, + ApproveOnSetup, + AlwaysDeny, + } + + internal Scenarios AutoProviderScenario { get; set; } + protected RelyingPartySecuritySettings RelyingPartySecuritySettings { get; private set; } protected ProviderSecuritySettings ProviderSecuritySettings { get; private set; } @@ -64,16 +73,6 @@ namespace DotNetOpenAuth.Test.OpenId { this.AutoProviderScenario = Scenarios.AutoApproval; } - public enum Scenarios { - AutoApproval, - AutoApprovalAddFragment, - ApproveOnSetup, - AlwaysDeny, - } - - internal Scenarios AutoProviderScenario { get; set; } - - /// <summary> /// Forces storage of an association in an RP's association store. /// </summary> diff --git a/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs b/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs index cf904c0..8d995ff 100644 --- a/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs +++ b/src/DotNetOpenAuth.Test/OpenId/UriIdentifierTests.cs @@ -353,8 +353,7 @@ namespace DotNetOpenAuth.Test.OpenId { Protocol protocol = Protocol.Lookup(version); Uri baseUrl = new Uri("http://localhost/"); UriIdentifier claimedId = new Uri(baseUrl, url); - UriIdentifier userSuppliedIdentifier = new Uri(baseUrl, - "Discovery/htmldiscovery/redirect.aspx?target=" + url); + UriIdentifier userSuppliedIdentifier = new Uri(baseUrl, "Discovery/htmldiscovery/redirect.aspx?target=" + url); if (expectedLocalId == null) { expectedLocalId = claimedId; } diff --git a/src/DotNetOpenAuth.Test/TestBase.cs b/src/DotNetOpenAuth.Test/TestBase.cs index 0d84a0d..db37c58 100644 --- a/src/DotNetOpenAuth.Test/TestBase.cs +++ b/src/DotNetOpenAuth.Test/TestBase.cs @@ -21,6 +21,12 @@ namespace DotNetOpenAuth.Test { internal static readonly string TestWebDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), @"..\..\..\..\src\DotNetOpenAuth.TestWeb")); /// <summary> + /// Gets or sets the test context which provides + /// information about and functionality for the current test run. + /// </summary> + public TestContext TestContext { get; set; } + + /// <summary> /// Gets the logger that tests should use. /// </summary> internal static ILog TestLogger { @@ -28,12 +34,6 @@ namespace DotNetOpenAuth.Test { } /// <summary> - /// Gets or sets the test context which provides - /// information about and functionality for the current test run. - /// </summary> - public TestContext TestContext { get; set; } - - /// <summary> /// The TestInitialize method for the test cases. /// </summary> [TestInitialize] |