Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Activating StyleCop on aspnet test assembly and fixed issues.

  • Loading branch information...
commit 15b4b6fbd7d9d3f4f09f95ba54d5389f46a58822 1 parent 71ad979
Andrew Arnott AArnott authored
10 Settings.StyleCop
View
@@ -1,13 +1,13 @@
<StyleCopSettings Version="4.3">
<Parsers>
- <Parser ParserId="Microsoft.StyleCop.CSharp.CsParser">
+ <Parser ParserId="StyleCop.CSharp.CsParser">
<ParserSettings>
<BooleanProperty Name="AnalyzeDesignerFiles">False</BooleanProperty>
</ParserSettings>
</Parser>
</Parsers>
<Analyzers>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.SpacingRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
<Rules>
<Rule Name="TabsMustNotBeUsed">
<RuleSettings>
@@ -17,7 +17,7 @@
</Rules>
<AnalyzerSettings />
</Analyzer>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.LayoutRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
<Rules>
<Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
<RuleSettings>
@@ -37,7 +37,7 @@
</Rules>
<AnalyzerSettings />
</Analyzer>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.ReadabilityRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
<Rules>
<Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
<RuleSettings>
@@ -52,7 +52,7 @@
</Rules>
<AnalyzerSettings />
</Analyzer>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<AnalyzerSettings>
<CollectionProperty Name="Hungarian">
<Value>ax</Value>
1  src/DotNetOpenAuth.AspNet.Test/DotNetOpenAuth.AspNet.Test.csproj
View
@@ -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>
16 src/DotNetOpenAuth.AspNet.Test/OAuth2ClientTest.cs
View
@@ -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 @@ public MockOAuth2Client()
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;
21 src/DotNetOpenAuth.AspNet.Test/OAuthAuthenticationTickerHelperTest.cs
View
@@ -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 @@ public class OAuthAuthenticationTickerHelperTest {
"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 @@ public class OAuthAuthenticationTickerHelperTest {
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 @@ public class OAuthAuthenticationTickerHelperTest {
"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>();
26 src/DotNetOpenAuth.AspNet.Test/OAuthClientTest.cs
View
@@ -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 class OAuthClientTest {
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 @@ public class OAuthClientTest {
}
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) {
}
8 src/DotNetOpenAuth.AspNet.Test/Properties/AssemblyInfo.cs
View
@@ -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;
10 src/DotNetOpenAuth.AspNet.Test/Settings.StyleCop
View
@@ -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>
32 src/DotNetOpenAuth.AspNet.Test/UriHelperTest.cs
View
@@ -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 class UriHelperTest {
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
Please sign in to comment.
Something went wrong with that request. Please try again.