diff options
Diffstat (limited to 'src')
7 files changed, 73 insertions, 41 deletions
diff --git a/src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj b/src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj index dd7228f..268b7cc 100644 --- a/src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj +++ b/src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj @@ -2,7 +2,6 @@ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))\EnlistmentInfo.props" Condition=" '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), EnlistmentInfo.props))' != '' " /> <PropertyGroup> - <StyleCopEnabled>False</StyleCopEnabled> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.30703</ProductVersion> diff --git a/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs b/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs index e979beb..89a483c 100644 --- a/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs +++ b/src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs @@ -1,4 +1,10 @@ -namespace DotNetOpenAuth.AspNet.Test { +//----------------------------------------------------------------------- +// <copyright file="OAuth2ClientTest.cs" company="Microsoft"> +// Copyright (c) Microsoft. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.AspNet.Test { using System; using System.Collections.Generic; using System.Collections.Specialized; @@ -113,10 +119,10 @@ protected override IDictionary<string, string> GetUserData(string accessToken) { if (accessToken == "abcde") { return new Dictionary<string, string> - { - {"id", "12345"}, - {"name", "John Doe"} - }; + { + { "id", "12345" }, + { "name", "John Doe" }, + }; } return null; diff --git a/src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs b/src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs index 78b8ca6..676a550 100644 --- a/src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs +++ b/src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs @@ -1,4 +1,10 @@ -namespace DotNetOpenAuth.Test.Web { +//----------------------------------------------------------------------- +// <copyright file="OAuthAuthenticationTickerHelperTest.cs" company="Microsoft"> +// Copyright (c) Microsoft. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.Test.Web { using System; using System.Web; using System.Web.Security; @@ -10,12 +16,12 @@ public class OAuthAuthenticationTickerHelperTest { [TestCase] public void SetAuthenticationTicketSetCookieOnHttpResponseWithPersistentSet() { - SetAuthenticationTicketSetCookieOnHttpResponse(isPersistent: true); + this.SetAuthenticationTicketSetCookieOnHttpResponse(isPersistent: true); } [TestCase] public void SetAuthenticationTicketSetCookieOnHttpResponseWithPersistentNotSet() { - SetAuthenticationTicketSetCookieOnHttpResponse(isPersistent: false); + this.SetAuthenticationTicketSetCookieOnHttpResponse(isPersistent: false); } [TestCase] @@ -30,8 +36,7 @@ "OAuth", FormsAuthentication.FormsCookiePath); - var cookie = new HttpCookie(name: FormsAuthentication.FormsCookieName, - value: FormsAuthentication.Encrypt(ticket)); + var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket)); var cookies = new HttpCookieCollection { cookie }; var context = new Mock<HttpContextBase>(); @@ -69,8 +74,7 @@ null, FormsAuthentication.FormsCookiePath); - var cookie = new HttpCookie(name: FormsAuthentication.FormsCookieName, - value: FormsAuthentication.Encrypt(ticket)); + var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket)); var cookies = new HttpCookieCollection { cookie }; var context = new Mock<HttpContextBase>(); @@ -97,8 +101,7 @@ "OAuth", FormsAuthentication.FormsCookiePath); - var cookie = new HttpCookie(name: "random cookie name", - value: FormsAuthentication.Encrypt(ticket)); + var cookie = new HttpCookie("random cookie name", FormsAuthentication.Encrypt(ticket)); var cookies = new HttpCookieCollection { cookie }; var context = new Mock<HttpContextBase>(); diff --git a/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs b/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs index f0eadd1..3b72b9e 100644 --- a/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs +++ b/src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs @@ -1,12 +1,18 @@ -namespace DotNetOpenAuth.AspNet.Test { +//----------------------------------------------------------------------- +// <copyright file="OAuthClientTest.cs" company="Microsoft"> +// Copyright (c) Microsoft. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.AspNet.Test { using System; using System.Web; + using DotNetOpenAuth.AspNet; + using DotNetOpenAuth.AspNet.Clients; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OAuth.Messages; - using DotNetOpenAuth.AspNet.Clients; using Moq; using NUnit.Framework; - using DotNetOpenAuth.AspNet; [TestFixture] public class OAuthClientTest { @@ -26,10 +32,9 @@ public void RequestAuthenticationInvokeMethodOnWebWorker() { // Arrange var webWorker = new Mock<IOAuthWebWorker>(MockBehavior.Strict); - webWorker.Setup( - w => w.RequestAuthentication( - It.Is<Uri>(u => u.ToString().Equals("http://live.com/my/path.cshtml?q=one")))) - .Verifiable(); + webWorker + .Setup(w => w.RequestAuthentication(It.Is<Uri>(u => u.ToString().Equals("http://live.com/my/path.cshtml?q=one")))) + .Verifiable(); var client = new MockOAuthClient(webWorker.Object); var returnUri = new Uri("http://live.com/my/path.cshtml?q=one"); @@ -113,10 +118,17 @@ } private class MockOAuthClient : OAuthClient { + /// <summary> + /// Initializes a new instance of the <see cref="MockOAuthClient"/> class. + /// </summary> public MockOAuthClient() : this(new Mock<IOAuthWebWorker>().Object) { } + /// <summary> + /// Initializes a new instance of the <see cref="MockOAuthClient"/> class. + /// </summary> + /// <param name="worker">The worker.</param> public MockOAuthClient(IOAuthWebWorker worker) : base("mockoauth", worker) { } diff --git a/src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs index f96cefe..d8a6a0b 100644 --- a/src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs +++ b/src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs @@ -1,4 +1,10 @@ -using System.Reflection; +//----------------------------------------------------------------------- +// <copyright file="AssemblyInfo.cs" company="Microsoft"> +// Copyright (c) Microsoft. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop b/src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop index ae8997c..63f402c 100644 --- a/src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop +++ b/src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop @@ -1,6 +1,6 @@ -<StyleCopSettings Version="4.3"> +<StyleCopSettings Version="105"> <Analyzers> - <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.DocumentationRules"> + <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules"> <Rules> <Rule Name="ElementsMustBeDocumented"> <RuleSettings> @@ -15,7 +15,7 @@ </Rules> <AnalyzerSettings /> </Analyzer> - <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.LayoutRules"> + <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules"> <Rules> <Rule Name="SingleLineCommentMustBePrecededByBlankLine"> <RuleSettings> @@ -25,7 +25,7 @@ </Rules> <AnalyzerSettings /> </Analyzer> - <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules"> + <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules"> <AnalyzerSettings> <CollectionProperty Name="Hungarian"> <Value>op</Value> @@ -34,7 +34,7 @@ </CollectionProperty> </AnalyzerSettings> </Analyzer> - <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.MaintainabilityRules"> + <Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules"> <Rules> <Rule Name="FieldsMustBePrivate"> <RuleSettings> diff --git a/src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs b/src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs index ea78a76..db60e17 100644 --- a/src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs +++ b/src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs @@ -1,4 +1,10 @@ -namespace DotNetOpenAuth.AspNet.Test { +//----------------------------------------------------------------------- +// <copyright file="UriHelperTest.cs" company="Microsoft"> +// Copyright (c) Microsoft. All rights reserved. +// </copyright> +//----------------------------------------------------------------------- + +namespace DotNetOpenAuth.AspNet.Test { using System; using DotNetOpenAuth.AspNet.Clients; using NUnit.Framework; @@ -9,20 +15,20 @@ public void TestAttachQueryStringParameterMethod() { // Arrange string[] input = new string[] - { - "http://x.com", - "https://xxx.com/one?s=123", - "https://yyy.com/?s=6&u=a", - "https://zzz.com/default.aspx?name=sd" - }; + { + "http://x.com", + "https://xxx.com/one?s=123", + "https://yyy.com/?s=6&u=a", + "https://zzz.com/default.aspx?name=sd" + }; string[] expectedOutput = new string[] - { - "http://x.com/?s=awesome", - "https://xxx.com/one?s=awesome", - "https://yyy.com/?s=awesome&u=a", - "https://zzz.com/default.aspx?name=sd&s=awesome" - }; + { + "http://x.com/?s=awesome", + "https://xxx.com/one?s=awesome", + "https://yyy.com/?s=awesome&u=a", + "https://zzz.com/default.aspx?name=sd&s=awesome" + }; for (int i = 0; i < input.Length; i++) { // Act |