Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enable StyleCop for test projects.

Fix a number of minor violations
  • Loading branch information...
commit d452fb0889782b1cec85c41d71ee70fc90d0f17d 1 parent 88176e4
Marcin Dobosz marcind authored
Showing with 590 additions and 723 deletions.
  1. +311 −34 Settings.StyleCop
  2. +1 −377 src/Settings.StyleCop
  3. +1 −1  test/Microsoft.TestCommon/Microsoft/TestCommon/MediaTypeAssert.cs
  4. +0 −13 test/Microsoft.Web.Helpers.Test/AnalyticsTest.cs
  5. +2 −2 test/Microsoft.Web.Helpers.Test/TwitterTest.cs
  6. +0 −1  test/Microsoft.Web.Http.Data.Test/Controllers/CatalogController.cs
  7. +106 −69 test/Settings.StyleCop
  8. +2 −2 test/System.Net.Http.Formatting.Test/Formatting/FormDataCollectionTests.cs
  9. +2 −1  test/System.Net.Http.Formatting.Test/Formatting/FormUrlEncodedFromContentTests.cs
  10. +2 −1  test/System.Net.Http.Formatting.Test/Formatting/FormUrlEncodedFromUriQueryTests.cs
  11. +0 −3  test/System.Net.Http.Formatting.Test/Formatting/JsonNetSerializationTest.cs
  12. +4 −4 test/System.Net.Http.Formatting.Test/Formatting/MediaTypeFormatterTestBase.cs
  13. +0 −1  test/System.Net.Http.Formatting.Test/Formatting/QueryStringMappingTests.cs
  14. +0 −1  test/System.Net.Http.Formatting.Test/Formatting/RequestHeaderMappingTests.cs
  15. +1 −1  test/System.Net.Http.Formatting.Test/Handlers/ProgressStreamTest.cs
  16. +6 −6 test/System.Net.Http.Formatting.Test/Handlers/ProgressWriteAsyncResultTest.cs
  17. +1 −1  test/System.Net.Http.Formatting.Test/HttpClientFactoryTest.cs
  18. +10 −10 test/System.Net.Http.Formatting.Test/Mocks/MockContentNegotiator.cs
  19. +1 −1  test/System.Net.Http.Formatting.Test/Mocks/MockMediaTypeFormatter.cs
  20. +3 −3 test/System.Web.Helpers.Test/CryptoTest.cs
  21. +3 −3 test/System.Web.Helpers.Test/HelperResultTest.cs
  22. +1 −1  test/System.Web.Helpers.Test/WebCacheTest.cs
  23. +0 −2  test/System.Web.Helpers.Test/WebGridTest.cs
  24. +2 −2 test/System.Web.Http.Integration.Test/Controllers/ApiControllerActionSelectorTest.cs
  25. +1 −2  test/System.Web.Http.Integration.Test/Tracing/MemoryTraceWriter.cs
  26. +2 −2 test/System.Web.Http.SelfHost.Test/DeeplyNestedTypeTests.cs
  27. +2 −2 test/System.Web.Http.Test/Controllers/ApiControllerTest.cs
  28. +1 −1  test/System.Web.Http.Test/Controllers/HttpParameterBindingTest.cs
  29. +5 −10 test/System.Web.Http.Test/Controllers/ParameterBindingExtensionsTest.cs
  30. +0 −1  test/System.Web.Http.Test/Controllers/ReflectedHttpActionDescriptorTest.cs
  31. +0 −1  test/System.Web.Http.Test/Filters/ExceptionFilterAttributeTest.cs
  32. +2 −1  test/System.Web.Http.Test/HttpResponseExceptionTest.cs
  33. +4 −4 test/System.Web.Http.Test/HttpServerTest.cs
  34. +0 −1  test/System.Web.Http.Test/Internal/CollectionModelBinderUtilTest.cs
  35. +0 −1  test/System.Web.Http.Test/ModelBinding/Binders/KeyValuePairModelBinderUtilTest.cs
  36. +2 −2 test/System.Web.Http.Test/ModelBinding/Binders/MutableObjectModelBinderTest.cs
  37. +23 −23 test/System.Web.Http.Test/ModelBinding/DefaultActionValueBinderTest.cs
  38. +0 −12 test/System.Web.Http.Test/Services/ControllerServicesTests.cs
  39. +9 −9 test/System.Web.Http.Test/Tracing/FormattingUtilitiesTest.cs
  40. +1 −1  test/System.Web.Http.Test/Tracing/TraceManagerTest.cs
  41. +5 −9 test/System.Web.Http.Test/Tracing/Tracers/BufferedMediaTypeFormatterTracerTest.cs
  42. +2 −3 test/System.Web.Http.Test/Tracing/Tracers/ExceptionFilterTracerTest.cs
  43. +1 −1  test/System.Web.Http.Test/Tracing/Tracers/FilterTracerTest.cs
  44. +1 −1  test/System.Web.Http.Test/Tracing/Tracers/FormatterParameterBindingTracerTest.cs
  45. +4 −8 test/System.Web.Http.Test/Tracing/Tracers/HttpActionBindingTracerTest.cs
  46. +0 −1  test/System.Web.Http.Test/Tracing/Tracers/HttpControllerDescriptorTracerTest.cs
  47. +6 −5 test/System.Web.Http.Test/Tracing/Tracers/MessageHandlerTracerTest.cs
  48. +11 −18 test/System.Web.Http.Test/Tracing/Tracers/ReadWriteMediaTypeFormatterTracerTestBase.cs
  49. +0 −1  test/System.Web.Http.Test/Validation/Providers/DataAnnotationsModelValidatorProviderTest.cs
  50. +1 −4 test/System.Web.Http.Test/Validation/Providers/InvalidModelValidatorProviderTest.cs
  51. +1 −1  test/System.Web.Http.Test/ValueProviders/Providers/QueryStringValueProviderTest.cs
  52. +1 −1  test/System.Web.Http.WebHost.Test/Routing/HttpRequestMessageWrapperTest.cs
  53. +1 −1  test/System.Web.Mvc.Test/ExpressionUtil/Test/HoistingExpressionVisitorTest.cs
  54. +1 −1  test/System.Web.Mvc.Test/Html/Test/DefaultEditorTemplatesTest.cs
  55. +22 −22 test/System.Web.Mvc.Test/Html/Test/ValidationExtensionsTest.cs
  56. +0 −8 test/System.Web.Mvc.Test/Test/TypeCacheUtilTest.cs
  57. +1 −1  test/System.Web.Razor.Test/Parser/CSharp/CSharpErrorTest.cs
  58. +0 −2  test/System.Web.Razor.Test/Parser/Html/HtmlAttributeTest.cs
  59. +2 −2 test/System.Web.Razor.Test/Text/TextReaderExtensionsTest.cs
  60. +0 −1  test/System.Web.WebPages.Deployment.Test/WebPagesDeploymentTest.cs
  61. +18 −18 test/System.Web.WebPages.Test/Html/ValidationHelperTest.cs
  62. +0 −1  test/System.Web.WebPages.Test/Validation/ValidationHelperTest.cs
  63. +1 −0  test/System.Web.WebPages.Test/WebPage/Utils.cs
345 Settings.StyleCop
View
@@ -1,15 +1,23 @@
-<StyleCopSettings Version="4.3">
-
-<!--
- This file was cloned directly from ndp\cdf\src
- to apply ADP conventions to all product source.
--->
+<StyleCopSettings Version="105">
<GlobalSettings>
<StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
</GlobalSettings>
+ <Parsers>
+ <Parser ParserId="StyleCop.CSharp.CsParser">
+ <ParserSettings>
+ <BooleanProperty Name="AnalyzeDesignerFiles">False</BooleanProperty>
+ </ParserSettings>
+ </Parser>
+ </Parsers>
<Analyzers>
-
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
+ <Rules>
+ <Rule Name="FieldNamesMustNotBeginWithUnderscore">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
<AnalyzerSettings>
<CollectionProperty Name="Hungarian">
<Value>as</Value>
@@ -31,22 +39,13 @@
</CollectionProperty>
</AnalyzerSettings>
</Analyzer>
-
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.DocumentationRules">
- <AnalyzerSettings>
- <BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
- <BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
- <StringProperty Name="Copyright">Copyright (c) Microsoft Corporation. All rights reserved.</StringProperty>
- </AnalyzerSettings>
-
+ <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="FileMustHaveHeader">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- Per ADP guidelines, the file header does not need to contain the name of the file. -->
<Rule Name="FileHeaderMustContainFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
@@ -57,53 +56,331 @@
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- Per ADP guidelines, the file header does not need to contain a Company attribute. -->
<Rule Name="FileHeaderMustHaveValidCompanyText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- Per ADP guidelines, constructor summary documentation does not have to match a specific format, since they are not directly consumed for external documentation. -->
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- Per ADP guidelines, destructor summary documentation does not have to match a specific format, since they are not directly consumed for external documentation. -->
<Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- Per ADP guidelines, documentation headers can contain blank lines, since they are not directly consumed for external documentation. -->
<Rule Name="DocumentationHeadersMustNotContainBlankLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
+ <Rule Name="ElementsMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PartialElementsMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="EnumerationItemsMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationMustContainValidXml">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationMustHaveSummary">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PartialElementDocumentationMustHaveSummary">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationMustHaveSummaryText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PartialElementDocumentationMustHaveSummaryText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementParametersMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementParameterDocumentationMustMatchElementParameters">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementParameterDocumentationMustDeclareParameterName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementParameterDocumentationMustHaveText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementReturnValueMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementReturnValueDocumentationMustHaveText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="VoidReturnValueMustNotBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParametersMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParameterDocumentationMustHaveText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PropertySummaryDocumentationMustMatchAccessors">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationTextMustNotBeEmpty">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationTextMustContainWhitespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationMustMeetCharacterPercentage">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="IncludedDocumentationXPathDoesNotExist">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="InheritDocMustBeUsedWithInheritingClass">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderMustShowCopyright">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderMustHaveCopyrightText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
</Rules>
+ <AnalyzerSettings>
+ <BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
+ <BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
+ </AnalyzerSettings>
</Analyzer>
-
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.ReadabilityRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
<Rules>
- <!-- Per ADP guidelines, the use of regions is not allowed (copied from CSD guidelines doc) -->
- <Rule Name="DoNotUseRegions">
+ <Rule Name="ParameterMustNotSpanMultipleLines">
<RuleSettings>
- <BooleanProperty Name="Enabled">True</BooleanProperty>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
- <!-- Per ADP guidelines, method parameter are allowed to span across multiple lines (rather than having to be assigned to a temporary variable). -->
- <Rule Name="ParameterMustNotSpanMultipleLines">
+ <Rule Name="PrefixLocalCallsWithThis">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ParameterMustFollowComma">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SplitParametersMustStartOnLineAfterDeclaration">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UseBuiltInTypeAlias">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="Microsoft.Web.StyleCop.Rules">
+ <AnalyzerSettings>
+ <StringProperty Name="FileHeaderText"> Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.</StringProperty>
+ </AnalyzerSettings>
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
+ <Rules>
+ <Rule Name="AllAccessorsMustBeMultiLineOrSingleLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingCurlyBracketMustBeFollowedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentMustBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementsMustBeSeparatedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
+ <Rules>
+ <Rule Name="FieldsMustBePrivate">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DebugAssertMustProvideMessageText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileMayOnlyContainASingleClass">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="StatementMustNotUseUnnecessaryParenthesis">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
+ <Rules>
+ <Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementsMustBeOrderedByAccess">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ConstantsMustAppearBeforeFields">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="StaticElementsMustAppearBeforeInstanceElements">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
+ <Rules>
+ <Rule Name="SingleLineCommentsMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
+ <AnalyzerSettings />
</Analyzer>
-
</Analyzers>
</StyleCopSettings>
378 src/Settings.StyleCop
View
@@ -1,381 +1,5 @@
<StyleCopSettings Version="105">
<GlobalSettings>
- <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
+ <StringProperty Name="MergeSettingsFiles">Parent</StringProperty>
</GlobalSettings>
- <Parsers>
- <Parser ParserId="StyleCop.CSharp.CsParser">
- <ParserSettings>
- <BooleanProperty Name="AnalyzeDesignerFiles">False</BooleanProperty>
- </ParserSettings>
- </Parser>
- </Parsers>
- <Analyzers>
- <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
- <Rules>
- <Rule Name="ElementsMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="PartialElementsMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="EnumerationItemsMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="DocumentationMustContainValidXml">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementDocumentationMustHaveSummary">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="PartialElementDocumentationMustHaveSummary">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementDocumentationMustHaveSummaryText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="PartialElementDocumentationMustHaveSummaryText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementParametersMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementParameterDocumentationMustMatchElementParameters">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementParameterDocumentationMustDeclareParameterName">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementParameterDocumentationMustHaveText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementReturnValueMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementReturnValueDocumentationMustHaveText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="VoidReturnValueMustNotBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="GenericTypeParametersMustBeDocumented">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="GenericTypeParameterDocumentationMustHaveText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="PropertySummaryDocumentationMustMatchAccessors">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="DocumentationTextMustNotBeEmpty">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="DocumentationTextMustContainWhitespace">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="DocumentationMustMeetCharacterPercentage">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="IncludedDocumentationXPathDoesNotExist">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="InheritDocMustBeUsedWithInheritingClass">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileMustHaveHeader">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileHeaderMustShowCopyright">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileHeaderMustHaveCopyrightText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="DocumentationHeadersMustNotContainBlankLines">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileHeaderMustContainFileName">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileHeaderMustHaveValidCompanyText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings>
- <BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
- <BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
- </AnalyzerSettings>
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
- <Rules>
- <Rule Name="ClosingCurlyBracketMustBeFollowedByBlankLine">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementsMustBeSeparatedByBlankLine">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="SingleLineCommentMustBePrecededByBlankLine">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="AllAccessorsMustBeMultiLineOrSingleLine">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
- <Rules>
- <Rule Name="DebugAssertMustProvideMessageText">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FileMayOnlyContainASingleClass">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="StatementMustNotUseUnnecessaryParenthesis">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="CodeAnalysisSuppressionMustHaveJustification">
- <RuleSettings>
- <BooleanProperty Name="Enabled">True</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="FieldsMustBePrivate">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
- <Rules>
- <Rule Name="FieldNamesMustNotBeginWithUnderscore">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings>
- <CollectionProperty Name="Hungarian">
- <Value>as</Value>
- <Value>do</Value>
- <Value>id</Value>
- <Value>if</Value>
- <Value>in</Value>
- <Value>is</Value>
- <Value>my</Value>
- <Value>no</Value>
- <Value>on</Value>
- <Value>to</Value>
- <Value>ui</Value>
- </CollectionProperty>
- </AnalyzerSettings>
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
- <Rules>
- <Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ElementsMustBeOrderedByAccess">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="StaticElementsMustAppearBeforeInstanceElements">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ConstantsMustAppearBeforeFields">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
- <Rules>
- <Rule Name="PrefixLocalCallsWithThis">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="SplitParametersMustStartOnLineAfterDeclaration">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="UseBuiltInTypeAlias">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ParameterMustFollowComma">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- <Rule Name="ParameterMustNotSpanMultipleLines">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- <Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
- <Rules>
- <Rule Name="SingleLineCommentsMustBeginWithSingleSpace">
- <RuleSettings>
- <BooleanProperty Name="Enabled">False</BooleanProperty>
- </RuleSettings>
- </Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- </Analyzers>
</StyleCopSettings>
2  test/Microsoft.TestCommon/Microsoft/TestCommon/MediaTypeAssert.cs
View
@@ -47,7 +47,7 @@ public void AreEqual(string expected, MediaTypeHeaderValue actual, string errorM
if (!String.IsNullOrEmpty(expected) || actual != null)
{
Assert.NotNull(expected);
- MediaTypeHeaderValue expectedMediaType = new MediaTypeHeaderValue(expected); ;
+ MediaTypeHeaderValue expectedMediaType = new MediaTypeHeaderValue(expected);
Assert.Equal(0, new MediaTypeHeaderValueComparer().Compare(expectedMediaType, actual));
}
}
13 test/Microsoft.Web.Helpers.Test/AnalyticsTest.cs
View
@@ -5,15 +5,8 @@
namespace Microsoft.Web.Helpers.Test
{
- /// <summary>
- ///This is a test class for AnalyticsTest and is intended
- ///to contain all AnalyticsTest Unit Tests
- ///</summary>
public class AnalyticsTest
{
- /// <summary>
- ///A test for GetYahooAnalyticsHtml
- ///</summary>
[Fact]
public void GetYahooAnalyticsHtmlTest()
{
@@ -22,9 +15,6 @@ public void GetYahooAnalyticsHtmlTest()
Assert.True(actual.Contains(".yahoo.com") && actual.Contains("My_yahoo_account"));
}
- /// <summary>
- ///A test for GetStatCounterAnalyticsHtml
- ///</summary>
[Fact]
public void GetStatCounterAnalyticsHtmlTest()
{
@@ -35,9 +25,6 @@ public void GetStatCounterAnalyticsHtmlTest()
actual.Contains(project.ToString()) && actual.Contains(security));
}
- /// <summary>
- ///A test for GetGoogleAnalyticsHtml
- ///</summary>
[Fact]
public void GetGoogleAnalyticsHtmlTest()
{
4 test/Microsoft.Web.Helpers.Test/TwitterTest.cs
View
@@ -12,8 +12,8 @@ namespace Microsoft.Web.Helpers.Test
public class TwitterTest
{
/// <summary>
- ///A test for Profile
- ///</summary>
+ /// A test for Profile
+ /// </summary>
[Fact]
public void Profile_ReturnsValidData()
{
1  test/Microsoft.Web.Http.Data.Test/Controllers/CatalogController.cs
View
@@ -33,7 +33,6 @@ public IEnumerable<Order_Detail> GetDetails(int orderId)
public void InsertOrder(Order order)
{
-
}
public void UpdateProduct(Product product)
175 test/Settings.StyleCop
View
@@ -1,111 +1,101 @@
-<StyleCopSettings Version="4.3">
+<StyleCopSettings Version="105">
<GlobalSettings>
- <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
- <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
+ <StringProperty Name="MergeSettingsFiles">Parent</StringProperty>
</GlobalSettings>
<Analyzers>
-
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.NamingRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<AnalyzerSettings>
- <CollectionProperty Name="Hungarian">
- <Value>as</Value>
- <Value>db</Value>
- <Value>dc</Value>
- <Value>do</Value>
- <Value>ef</Value>
- <Value>id</Value>
- <Value>if</Value>
- <Value>in</Value>
- <Value>is</Value>
- <Value>my</Value>
- <Value>no</Value>
- <Value>on</Value>
- <Value>sl</Value>
- <Value>to</Value>
- <Value>ui</Value>
- <Value>vs</Value>
- </CollectionProperty>
- </AnalyzerSettings>
- </Analyzer>
-
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.DocumentationRules">
- <AnalyzerSettings>
- <BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
- <BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
<BooleanProperty Name="IncludeFields">False</BooleanProperty>
-
- <StringProperty Name="Copyright">Copyright (c) Microsoft Corporation. All rights reserved.</StringProperty>
</AnalyzerSettings>
-
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
<Rules>
- <!-- For non-product code, do not require enum items to be documented. -->
- <Rule Name="EnumerationItemsMustBeDocumented">
+ <Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- For non-product code, do not require specific wording of property and indexer summary. -->
- <Rule Name="PropertySummaryDocumentationMustMatchAccessors">
+ <Rule Name="StatementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
- <Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
+ <Rule Name="ElementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- For non-product code, do not require specific wording of constuctor and destructor summary. -->
- <Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
+ <Rule Name="CurlyBracketsMustNotBeOmitted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
- <Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
+ <Rule Name="CodeMustNotContainMultipleBlankLinesInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- Documentation headers can contain blank lines, since they are not directly consumed for external documentation. -->
- <Rule Name="DocumentationHeadersMustNotContainBlankLines">
+ <Rule Name="ClosingCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- Do not require the file header to contain the name of the file. -->
- <Rule Name="FileHeaderMustContainFileName">
+ <Rule Name="OpeningCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
- <Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
+ <Rules>
+ <Rule Name="AccessModifierMustBeDeclared">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
-
- <!-- Do not require the file header to contain a Company attribute. -->
- <Rule Name="FileHeaderMustHaveValidCompanyText">
+ <Rule Name="FileMayOnlyContainASingleNamespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="RemoveDelegateParenthesisWhenPossible">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
+ <AnalyzerSettings />
</Analyzer>
-
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.OrderingRules">
- <!-- For non-product code, do not enforce specific ordering of elements. -->
+ <Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<Rules>
- <Rule Name="ElementsMustBeOrderedByAccess">
+ <Rule Name="ElementMustBeginWithUpperCaseLetter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
- <Rule Name="StaticElementsMustAppearBeforeInstanceElements">
+ <Rule Name="ConstFieldNamesMustBeginWithUpperCaseLetter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FieldNamesMustNotUseHungarianNotation">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FieldNamesMustBeginWithLowerCaseLetter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="AccessibleFieldsMustBeginWithUpperCaseLetter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FieldNamesMustNotContainUnderscore">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
@@ -113,33 +103,80 @@
</Rules>
<AnalyzerSettings />
</Analyzer>
-
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.MaintainabilityRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
<Rules>
- <!-- For non-product code, allow multiple classes and namespaces within a file. -->
- <Rule Name="FileMayOnlyContainASingleClass">
+ <Rule Name="ElementsMustAppearInTheCorrectOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
- <Rule Name="FileMayOnlyContainASingleNamespace">
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
+ <Rules>
+ <Rule Name="DoNotPrefixCallsWithBaseUnlessLocalImplementationExists">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingParenthesisMustBeOnLineOfLastParameter">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UseStringEmptyForEmptyStrings">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UseShorthandForNullableTypes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
+ <AnalyzerSettings />
</Analyzer>
-
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.ReadabilityRules">
+ <Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
<Rules>
- <!-- Per ADP guidelines, method parameter are allowed to span across multiple lines (rather than having to be assigned to a temporary variable). -->
- <Rule Name="ParameterMustNotSpanMultipleLines">
+ <Rule Name="CommasMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SemicolonsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PreprocessorKeywordsMustNotBePrecededBySpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingParenthesisMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningCurlyBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
+ <AnalyzerSettings />
</Analyzer>
-
</Analyzers>
-</StyleCopSettings>
+</StyleCopSettings>
4 test/System.Net.Http.Formatting.Test/Formatting/FormDataCollectionTests.cs
View
@@ -93,7 +93,7 @@ public void GetValues()
{
FormDataCollection form = new FormDataCollection(new Uri("http://foo.com/?x=1&x=2&x=3"));
- Assert.Equal(new string [] { "1", "2", "3"}, form.GetValues("x"));
+ Assert.Equal(new string[] { "1", "2", "3"}, form.GetValues("x"));
}
[Fact]
@@ -138,7 +138,7 @@ public void ToNameValueCollection()
[InlineData("x=", "")] // rhs only
[InlineData("x=%20", SPACE)] // escaped space
[InlineData("x=" + SPACE, SPACE)] // literal space
- [InlineData("x=+", SPACE)] //
+ [InlineData("x=+", SPACE)]
[InlineData("x=null", "null")] // null literal, not escaped
[InlineData("x=undefined", "undefined")] // undefined literal, not escaped
[InlineData("x=\"null\"", "\"null\"")] // quoted null, preserved as is
3  test/System.Net.Http.Formatting.Test/Formatting/FormUrlEncodedFromContentTests.cs
View
@@ -457,8 +457,9 @@ private static void BuildParams(string prefix, JToken jsonValue, List<string> re
}
}
}
- else //jsonValue is JObject
+ else
{
+ //jsonValue is JObject
foreach (KeyValuePair<string, JToken> item in (JObject)jsonValue)
{
BuildParams(prefix + "[" + item.Key + "]", item.Value, results);
3  test/System.Net.Http.Formatting.Test/Formatting/FormUrlEncodedFromUriQueryTests.cs
View
@@ -382,8 +382,9 @@ private static void BuildParams(string prefix, JToken jsonValue, List<string> re
}
}
}
- else //jsonValue is JObject
+ else
{
+ //jsonValue is JObject
foreach (KeyValuePair<string, JToken> item in (JObject)jsonValue)
{
BuildParams(prefix + "[" + item.Key + "]", item.Value, results);
3  test/System.Net.Http.Formatting.Test/Formatting/JsonNetSerializationTest.cs
View
@@ -484,12 +484,10 @@ public class Ref
public class Base
{
-
}
public class Derived : Base
{
-
}
[DataContract]
@@ -524,6 +522,5 @@ public void OnDeserialized(StreamingContext c)
public class DangerousType
{
-
}
}
8 test/System.Net.Http.Formatting.Test/Formatting/MediaTypeFormatterTestBase.cs
View
@@ -101,8 +101,8 @@ public Task ReadFromStreamAsync_WhenContentLengthIsZero_DoesNotReadStream()
contentHeaders.ContentLength = 0;
// Act
- return formatter.ReadFromStreamAsync(typeof(object), mockStream.Object, content, mockFormatterLogger).
- ContinueWith(
+ return formatter.ReadFromStreamAsync(typeof(object), mockStream.Object, content, mockFormatterLogger)
+ .ContinueWith(
readTask =>
{
// Assert
@@ -125,8 +125,8 @@ public Task ReadFromStreamAsync_WhenContentLengthIsZero_DoesNotCloseStream()
contentHeaders.ContentLength = 0;
// Act
- return formatter.ReadFromStreamAsync(typeof(object), mockStream.Object, content, mockFormatterLogger).
- ContinueWith(
+ return formatter.ReadFromStreamAsync(typeof(object), mockStream.Object, content, mockFormatterLogger)
+ .ContinueWith(
readTask =>
{
// Assert
1  test/System.Net.Http.Formatting.Test/Formatting/QueryStringMappingTests.cs
View
@@ -120,7 +120,6 @@ public void Constructor1ThrowsWithEmptyMediaType(string queryStringParameterName
typeof(QueryStringMappingTests), "UriStringsWithoutQuery")]
public void TryMatchMediaTypeReturnsMatchWithQueryStringParameterNameAndValueInUri(string queryStringParameterName, string queryStringParameterValue, string mediaType, string uriBase)
{
-
QueryStringMapping mapping = new QueryStringMapping(queryStringParameterName, queryStringParameterValue, mediaType);
string uri = uriBase + "?" + queryStringParameterName + "=" + queryStringParameterValue;
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, uri);
1  test/System.Net.Http.Formatting.Test/Formatting/RequestHeaderMappingTests.cs
View
@@ -11,7 +11,6 @@ namespace System.Net.Http.Formatting
{
public class RequestHeaderMappingTests
{
-
[Fact]
public void TypeIsCorrect()
{
2  test/System.Net.Http.Formatting.Test/Handlers/ProgressStreamTest.cs
View
@@ -2,9 +2,9 @@
using System.IO;
using System.Text;
+using System.Threading;
using Moq;
using Xunit;
-using System.Threading;
namespace System.Net.Http.Handlers
{
12 test/System.Net.Http.Formatting.Test/Handlers/ProgressWriteAsyncResultTest.cs
View
@@ -36,8 +36,8 @@ public void Constructor_CompletesSynchronouslyIfInnerStreamCompletesSynchronousl
Mock<Stream> mockInnerStream = new Mock<Stream>();
object userState = new object();
IAsyncResult mockIAsyncResult = CreateMockCompletedAsyncResult(true, userState);
- mockInnerStream.Setup(s => s.BeginWrite(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<AsyncCallback>(), It.IsAny<object>())).
- Returns(mockIAsyncResult);
+ mockInnerStream.Setup(s => s.BeginWrite(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<AsyncCallback>(), It.IsAny<object>()))
+ .Returns(mockIAsyncResult);
ProgressStream progressStream = ProgressStreamTest.CreateProgressStream();
// Act
@@ -55,8 +55,8 @@ public void Constructor_CompletesWithExceptionIfInnerStreamThrows()
{
// Arrange
Mock<Stream> mockInnerStream = new Mock<Stream>();
- mockInnerStream.Setup(s => s.BeginWrite(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<AsyncCallback>(), It.IsAny<object>())).
- Throws<ApplicationException>();
+ mockInnerStream.Setup(s => s.BeginWrite(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<AsyncCallback>(), It.IsAny<object>()))
+ .Throws<ApplicationException>();
ProgressStream progressStream = ProgressStreamTest.CreateProgressStream();
// Act
@@ -77,8 +77,8 @@ public void Constructor_ReportsBytesWritten(int offset, int count)
Mock<Stream> mockInnerStream = new Mock<Stream>();
object userState = new object();
IAsyncResult mockIAsyncResult = CreateMockCompletedAsyncResult(true, userState);
- mockInnerStream.Setup(s => s.BeginWrite(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<AsyncCallback>(), It.IsAny<object>())).
- Returns(mockIAsyncResult);
+ mockInnerStream.Setup(s => s.BeginWrite(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>(), It.IsAny<AsyncCallback>(), It.IsAny<object>()))
+ .Returns(mockIAsyncResult);
MockProgressEventHandler mockProgressHandler;
ProgressMessageHandler progressMessageHandler = MockProgressEventHandler.CreateProgressMessageHandler(out mockProgressHandler, sendProgress: true);
2  test/System.Net.Http.Formatting.Test/HttpClientFactoryTest.cs
View
@@ -106,7 +106,7 @@ public void CreatePipeline_WiresUpHandlers(int maxHandlerCount)
for (int handlerCount = 0; handlerCount < maxHandlerCount; handlerCount++)
{
handlers.Add(new MockDelegatingHandler());
- };
+ }
HttpClientHandler innerHandler = new HttpClientHandler();
20 test/System.Net.Http.Formatting.Test/Mocks/MockContentNegotiator.cs
View
@@ -18,52 +18,52 @@ public MockContentNegotiator(bool excludeMatchOnTypeOnly)
{
}
- new public Collection<MediaTypeFormatterMatch> ComputeFormatterMatches(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
+ public new Collection<MediaTypeFormatterMatch> ComputeFormatterMatches(Type type, HttpRequestMessage request, IEnumerable<MediaTypeFormatter> formatters)
{
return base.ComputeFormatterMatches(type, request, formatters);
}
- new public MediaTypeFormatterMatch SelectResponseMediaTypeFormatter(ICollection<MediaTypeFormatterMatch> matches)
+ public new MediaTypeFormatterMatch SelectResponseMediaTypeFormatter(ICollection<MediaTypeFormatterMatch> matches)
{
return base.SelectResponseMediaTypeFormatter(matches);
}
- new public Encoding SelectResponseCharacterEncoding(HttpRequestMessage request, MediaTypeFormatter formatter)
+ public new Encoding SelectResponseCharacterEncoding(HttpRequestMessage request, MediaTypeFormatter formatter)
{
return base.SelectResponseCharacterEncoding(request, formatter);
}
- new public MediaTypeFormatterMatch MatchMediaTypeMapping(HttpRequestMessage request, MediaTypeFormatter formatter)
+ public new MediaTypeFormatterMatch MatchMediaTypeMapping(HttpRequestMessage request, MediaTypeFormatter formatter)
{
return base.MatchMediaTypeMapping(request, formatter);
}
- new public MediaTypeFormatterMatch MatchAcceptHeader(IEnumerable<MediaTypeWithQualityHeaderValue> sortedAcceptValues, MediaTypeFormatter formatter)
+ public new MediaTypeFormatterMatch MatchAcceptHeader(IEnumerable<MediaTypeWithQualityHeaderValue> sortedAcceptValues, MediaTypeFormatter formatter)
{
return base.MatchAcceptHeader(sortedAcceptValues, formatter);
}
- new public MediaTypeFormatterMatch MatchRequestMediaType(HttpRequestMessage request, MediaTypeFormatter formatter)
+ public new MediaTypeFormatterMatch MatchRequestMediaType(HttpRequestMessage request, MediaTypeFormatter formatter)
{
return base.MatchRequestMediaType(request, formatter);
}
- new public MediaTypeFormatterMatch MatchType(Type type, MediaTypeFormatter formatter)
+ public new MediaTypeFormatterMatch MatchType(Type type, MediaTypeFormatter formatter)
{
return base.MatchType(type, formatter);
}
- new public IEnumerable<MediaTypeWithQualityHeaderValue> SortMediaTypeWithQualityHeaderValuesByQFactor(ICollection<MediaTypeWithQualityHeaderValue> headerValues)
+ public new IEnumerable<MediaTypeWithQualityHeaderValue> SortMediaTypeWithQualityHeaderValuesByQFactor(ICollection<MediaTypeWithQualityHeaderValue> headerValues)
{
return base.SortMediaTypeWithQualityHeaderValuesByQFactor(headerValues);
}
- new public IEnumerable<StringWithQualityHeaderValue> SortStringWithQualityHeaderValuesByQFactor(ICollection<StringWithQualityHeaderValue> headerValues)
+ public new IEnumerable<StringWithQualityHeaderValue> SortStringWithQualityHeaderValuesByQFactor(ICollection<StringWithQualityHeaderValue> headerValues)
{
return base.SortStringWithQualityHeaderValuesByQFactor(headerValues);
}
- new public MediaTypeFormatterMatch UpdateBestMatch(MediaTypeFormatterMatch current, MediaTypeFormatterMatch potentialReplacement)
+ public new MediaTypeFormatterMatch UpdateBestMatch(MediaTypeFormatterMatch current, MediaTypeFormatterMatch potentialReplacement)
{
return base.UpdateBestMatch(current, potentialReplacement);
}
2  test/System.Net.Http.Formatting.Test/Mocks/MockMediaTypeFormatter.cs
View
@@ -31,7 +31,7 @@ public override bool CanWriteType(Type type)
return CanWriteTypeCallback != null ? CanWriteTypeCallback(type) : true;
}
- new public Encoding SelectCharacterEncoding(HttpContentHeaders contentHeaders)
+ public new Encoding SelectCharacterEncoding(HttpContentHeaders contentHeaders)
{
return base.SelectCharacterEncoding(contentHeaders);
}
6 test/System.Web.Helpers.Test/CryptoTest.cs
View
@@ -9,9 +9,9 @@
namespace System.Web.Helpers.Test
{
/// <summary>
- ///This is a test class for CryptoTest and is intended
- ///to contain all CryptoTest Unit Tests
- ///</summary>
+ /// This is a test class for CryptoTest and is intended
+ /// to contain all CryptoTest Unit Tests
+ /// </summary>
public class CryptoTest
{
[Fact]
6 test/System.Web.Helpers.Test/HelperResultTest.cs
View
@@ -8,9 +8,9 @@
namespace System.Web.Helpers.Test
{
/// <summary>
- ///This is a test class for Util is intended
- ///to contain all HelperResult Unit Tests
- ///</summary>
+ /// This is a test class for Util is intended
+ /// to contain all HelperResult Unit Tests
+ /// </summary>
public class HelperResultTest
{
[Fact]
2  test/System.Web.Helpers.Test/WebCacheTest.cs
View
@@ -101,7 +101,7 @@ public void SetWithSlidingExpirationForMoreThanYear()
{
string key = DateTime.UtcNow.Ticks.ToString() + "_SetWithSlidingExpirationForMoreThanYear_SetTest";
object expected = new object();
- Assert.ThrowsArgumentLessThanOrEqualTo(() => WebCache.Set(key, expected, 365 * 24 * 60 + 1, true), "minutesToCache", (365 * 24 * 60).ToString());
+ Assert.ThrowsArgumentLessThanOrEqualTo(() => WebCache.Set(key, expected, (365 * 24 * 60) + 1, true), "minutesToCache", (365 * 24 * 60).ToString());
}
[Fact]
2  test/System.Web.Helpers.Test/WebGridTest.cs
View
@@ -2214,7 +2214,6 @@ public void GetElementTypeReturnsEnumerableTypeIfCollectionImplementsEnumerable(
{
// Arrange
IEnumerable<Person> elements = new NonGenericEnumerable(new[] { new Person { FirstName = "Foo", LastName = "Bar" } });
- ;
// Act
Type type = WebGrid.GetElementType(elements);
@@ -2228,7 +2227,6 @@ public void GetElementTypeReturnsEnumerableTypeIfCollectionIsIEnumerable()
{
// Arrange
IEnumerable<Person> elements = new GenericEnumerable<Person>(new[] { new Person { FirstName = "Foo", LastName = "Bar" } });
- ;
// Act
Type type = WebGrid.GetElementType(elements);
4 test/System.Web.Http.Integration.Test/Controllers/ApiControllerActionSelectorTest.cs
View
@@ -23,8 +23,8 @@ public class ApiControllerActionSelectorTest
[InlineData("GET", "Test/5?random=9", "GetUser")]
[InlineData("Post", "Test", "PostUser")]
[InlineData("Post", "Test?name=mario&age=10", "PostUserByNameAndAge")]
- /// Note: Normally the following would not match DeleteUserByIdAndOptName because it has 'id' and 'age' as parameters while the DeleteUserByIdAndOptName action has 'id' and 'name'.
- /// However, because the default value is provided on action parameter 'name', having the 'id' in the request was enough to match the action.
+ // Note: Normally the following would not match DeleteUserByIdAndOptName because it has 'id' and 'age' as parameters while the DeleteUserByIdAndOptName action has 'id' and 'name'.
+ // However, because the default value is provided on action parameter 'name', having the 'id' in the request was enough to match the action.
[InlineData("Delete", "Test/6?age=10", "DeleteUserByIdAndOptName")]
[InlineData("Delete", "Test", "DeleteUserByOptName")]
[InlineData("Delete", "Test?name=user", "DeleteUserByOptName")]
3  test/System.Web.Http.Integration.Test/Tracing/MemoryTraceWriter.cs
View
@@ -39,5 +39,4 @@ public void Finish()
public IList<TraceRecord> Records { get { return _records; } }
}
-}
-
+}
4 test/System.Web.Http.SelfHost.Test/DeeplyNestedTypeTests.cs
View
@@ -5,10 +5,10 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
+using System.Xml;
+using System.Xml.Linq;
using Newtonsoft.Json.Linq;
using Xunit;
-using System.Xml.Linq;
-using System.Xml;
namespace System.Web.Http.SelfHost
{
4 test/System.Web.Http.Test/Controllers/ApiControllerTest.cs
View
@@ -326,8 +326,8 @@ public void ExecuteAsync_InvokesAuthorizationFilters_ThenInvokesModelBinding_The
Mock<HttpActionDescriptor> actionDescriptorMock = new Mock<HttpActionDescriptor>();
actionDescriptorMock.Setup(ad => ad.ActionBinding).Returns(actionBindingMock.Object);
- actionDescriptorMock.Setup(ad => ad.GetFilterPipeline()).
- Returns(new Collection<FilterInfo>(new List<FilterInfo>() { new FilterInfo(actionFilterMock.Object, FilterScope.Action), new FilterInfo(authFilterMock.Object, FilterScope.Action) }));
+ actionDescriptorMock.Setup(ad => ad.GetFilterPipeline())
+ .Returns(new Collection<FilterInfo>(new List<FilterInfo>() { new FilterInfo(actionFilterMock.Object, FilterScope.Action), new FilterInfo(authFilterMock.Object, FilterScope.Action) }));
selectorMock.Setup(s => s.SelectAction(controllerContext)).Returns(actionDescriptorMock.Object);
2  test/System.Web.Http.Test/Controllers/HttpParameterBindingTest.cs
View
@@ -29,7 +29,7 @@ public void GetValue_Returns_Set()
HttpActionContext ctx = new HttpActionContext();
// Act
- object result = "abc";
+ object result = "abc";
binding.SetValue(ctx, result);
var result2 = binding.GetValue(ctx);
15 test/System.Web.Http.Test/Controllers/ParameterBindingExtensionsTest.cs
View
@@ -1,19 +1,14 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-using System.ComponentModel;
+using System.Collections.Generic;
using System.Linq;
-using System.Net.Http;
-using System.Reflection;
-using System.Threading;
-using System.Web.Http.Controllers;
+using System.Net.Http.Formatting;
+using System.Web.Http.ModelBinding;
+using System.Web.Http.Validation;
using System.Web.Http.ValueProviders;
+using Moq;
using Xunit;
using Assert = Microsoft.TestCommon.AssertEx;
-using Moq;
-using System.Web.Http.ModelBinding;
-using System.Collections.Generic;
-using System.Net.Http.Formatting;
-using System.Web.Http.Validation;
namespace System.Web.Http.Controllers
{
1  test/System.Web.Http.Test/Controllers/ReflectedHttpActionDescriptorTest.cs
View
@@ -9,7 +9,6 @@
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.Controllers;
-using System.Web.Http.Dispatcher;
using System.Web.Http.Filters;
using Moq;
using Xunit;
1  test/System.Web.Http.Test/Filters/ExceptionFilterAttributeTest.cs
View
@@ -78,7 +78,6 @@ public void ExecuteExceptionFilterAsync_ReturnsCompletedTask()
public sealed class TestableExceptionFilter : ExceptionFilterAttribute
{
-
}
}
}
3  test/System.Web.Http.Test/HttpResponseExceptionTest.cs
View
@@ -23,7 +23,8 @@ public void Constructor_SetsResponseProperty()
var exception = new HttpResponseException(response);
Assert.Same(response, exception.Response);
- if(Assert.CurrentCultureIsEnglish) {
+ if (Assert.CurrentCultureIsEnglish)
+ {
Assert.Equal("Processing of the HTTP request resulted in an exception. Please see the HTTP response returned by the 'Response' property of this exception for details.", exception.Message);
}
}
8 test/System.Web.Http.Test/HttpServerTest.cs
View
@@ -119,8 +119,8 @@ public Task<HttpResponseMessage> RequestGetsConfigurationAsParameter()
HttpConfiguration config = new HttpConfiguration();
Mock<HttpControllerDispatcher> dispatcherMock = new Mock<HttpControllerDispatcher>(config);
- dispatcherMock.Protected().Setup<Task<HttpResponseMessage>>("SendAsync", request, CancellationToken.None).
- Returns(TaskHelpers.FromResult<HttpResponseMessage>(request.CreateResponse()));
+ dispatcherMock.Protected().Setup<Task<HttpResponseMessage>>("SendAsync", request, CancellationToken.None)
+ .Returns(TaskHelpers.FromResult<HttpResponseMessage>(request.CreateResponse()));
HttpServer server = new HttpServer(config, dispatcherMock.Object);
HttpMessageInvoker invoker = new HttpMessageInvoker(server);
@@ -145,8 +145,8 @@ public Task<HttpResponseMessage> RequestGetsSyncContextAsParameter()
HttpConfiguration config = new HttpConfiguration();
Mock<HttpControllerDispatcher> dispatcherMock = new Mock<HttpControllerDispatcher>(config);
- dispatcherMock.Protected().Setup<Task<HttpResponseMessage>>("SendAsync", request, CancellationToken.None).
- Returns(TaskHelpers.FromResult<HttpResponseMessage>(request.CreateResponse()));
+ dispatcherMock.Protected().Setup<Task<HttpResponseMessage>>("SendAsync", request, CancellationToken.None)
+ .Returns(TaskHelpers.FromResult<HttpResponseMessage>(request.CreateResponse()));
HttpServer server = new HttpServer(config, dispatcherMock.Object);
HttpMessageInvoker invoker = new HttpMessageInvoker(server);
1  test/System.Web.Http.Test/Internal/CollectionModelBinderUtilTest.cs
View
@@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-using System.Web.Http.Metadata;
using System.Web.Http.Metadata.Providers;
using System.Web.Http.ModelBinding;
using System.Web.Http.ValueProviders;
1  test/System.Web.Http.Test/ModelBinding/Binders/KeyValuePairModelBinderUtilTest.cs
View
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System.Web.Http.Controllers;
-using System.Web.Http.Internal;
using System.Web.Http.Metadata.Providers;
using System.Web.Http.Util;
using Moq;
4 test/System.Web.Http.Test/ModelBinding/Binders/MutableObjectModelBinderTest.cs
View
@@ -8,10 +8,10 @@
using System.Web.Http.Metadata;
using System.Web.Http.Metadata.Providers;
using System.Web.Http.Validation;
+using System.Web.Http.ValueProviders;
using Moq;
using Xunit;
using Assert = Microsoft.TestCommon.AssertEx;
-using System.Web.Http.ValueProviders;
namespace System.Web.Http.ModelBinding.Binders
{
@@ -748,7 +748,7 @@ public virtual void SetPropertyPublic(HttpActionContext context, ModelBindingCon
protected override void SetProperty(HttpActionContext actionContext, ModelBindingContext bindingContext, ModelMetadata propertyMetadata, ComplexModelDtoResult dtoResult, ModelValidator requiredValidator)
{
- SetPropertyPublic(actionContext, bindingContext, propertyMetadata, dtoResult, requiredValidator);
+ SetPropertyPublic(actionContext, bindingContext, propertyMetadata, dtoResult, requiredValidator);
}
}
}
46 test/System.Web.Http.Test/ModelBinding/DefaultActionValueBinderTest.cs
View
@@ -7,9 +7,9 @@
using System.Threading;
using System.Web.Http.Controllers;
using System.Web.Http.ValueProviders;
+using Moq;
using Xunit;
using Assert = Microsoft.TestCommon.AssertEx;
-using Moq;
namespace System.Web.Http.ModelBinding
{
@@ -21,7 +21,7 @@ public void BindValuesAsync_Throws_Null_ActionDescriptor()
{
// Arrange
HttpActionDescriptor actionDescriptor = new ReflectedHttpActionDescriptor { MethodInfo = (MethodInfo)MethodInfo.GetCurrentMethod() };
-
+
// Act and Assert
Assert.ThrowsArgumentNull(
() => new DefaultActionValueBinder().GetBinding(null),
@@ -79,10 +79,10 @@ public void Check_SimpleTypes_Are_ModelBound()
var binding = binder.GetBinding(GetAction("Action_SimpleTypes"));
- for(int i = 0; i < binding.ParameterBindings.Length; i++)
+ for (int i = 0; i < binding.ParameterBindings.Length; i++)
{
AssertIsModelBound(binding, 0);
- }
+ }
}
private void Action_ComplexTypeWithStringConverter(ComplexTypeWithStringConverter x) { }
@@ -95,7 +95,7 @@ public void Check_String_TypeConverter_Is_ModelBound()
var binding = binder.GetBinding(GetAction("Action_ComplexTypeWithStringConverter"));
Assert.Equal(1, binding.ParameterBindings.Length);
- AssertIsModelBound(binding, 0);
+ AssertIsModelBound(binding, 0);
}
private void Action_ComplexTypeWithStringConverter_Body_Override([FromBody] ComplexTypeWithStringConverter x) { }
@@ -130,7 +130,7 @@ public void Check_NullableInt_Is_ModelBound()
public void Check_Nullable_ValueType_Is_FromBody()
{
DefaultActionValueBinder binder = new DefaultActionValueBinder();
-
+
var binding = binder.GetBinding(GetAction("Action_Nullable_ValueType"));
Assert.Equal(1, binding.ParameterBindings.Length);
@@ -175,7 +175,7 @@ public void Check_Empty_Action()
var binding = binder.GetBinding(GetAction("Action_Empty"));
Assert.NotNull(binding.ParameterBindings);
- Assert.Equal(0, binding.ParameterBindings.Length);
+ Assert.Equal(0, binding.ParameterBindings.Length);
}
private void Action_String_String(string s1, string s2) { }
@@ -202,9 +202,9 @@ public void Check_Complex_Type_FromBody()
var binding = binder.GetBinding(GetAction("Action_Complex_Type"));
Assert.Equal(1, binding.ParameterBindings.Length);
- AssertIsBody(binding, 0);
+ AssertIsBody(binding, 0);
}
-
+
[Fact]
public void Check_Config_Override_Use_ModelBinding()
{
@@ -215,7 +215,7 @@ public void Check_Config_Override_Use_ModelBinding()
var binding = binder.GetBinding(GetAction("Action_Complex_Type", config));
Assert.Equal(1, binding.ParameterBindings.Length);
- AssertIsModelBound(binding, 0);
+ AssertIsModelBound(binding, 0);
}
@@ -271,7 +271,7 @@ public void Check_Two_Complex_Types_FromBody()
// It's illegal to have multiple parameters from the body.
// But we should still be able to get a binding for it. We just can't execute it.
var binding = binder.GetBinding(GetAction("Action_Two_Complex_Types"));
-
+
Assert.Equal(2, binding.ParameterBindings.Length);
AssertIsError(binding, 0);
AssertIsError(binding, 1);
@@ -321,7 +321,7 @@ public void Check_CustomModelBinder_On_Parameter()
Assert.Equal(1, binding.ParameterBindings.Length);
AssertIsModelBound(binding, 0);
- ModelBinderParameterBinding p = (ModelBinderParameterBinding) binding.ParameterBindings[0];
+ ModelBinderParameterBinding p = (ModelBinderParameterBinding)binding.ParameterBindings[0];
Assert.IsType<CustomModelBinder>(p.Binder);
// Since the ModelBinderAttribute didn't specify the valueproviders, we should pull those from config.
@@ -383,7 +383,7 @@ public void Check_HttpContent()
DefaultActionValueBinder binder = new DefaultActionValueBinder();
var binding = binder.GetBinding(GetAction("Action_HttpContent_Parameter"));
-
+
Assert.Equal(1, binding.ParameterBindings.Length);
AssertIsError(binding, 0);
}
@@ -438,7 +438,7 @@ public override HttpParameterBinding GetBinding(HttpParameterDescriptor paramete
return MockBinding;
}
- private class CustomBinding : HttpParameterBinding
+ private class CustomBinding : HttpParameterBinding
{
public CustomBinding()
: base(new Mock<HttpParameterDescriptor>().Object)
@@ -459,7 +459,7 @@ private void AssertIsBody(HttpActionBinding binding, int paramIdx)
HttpParameterBinding p = binding.ParameterBindings[paramIdx];
Assert.NotNull(p);
Assert.True(p.IsValid);
- Assert.True(p.WillReadBody);
+ Assert.True(p.WillReadBody);
}
// Assert that the binding contract says the given parameter is not from the body (will be handled by model binding)
@@ -469,13 +469,13 @@ private void AssertIsModelBound(HttpActionBinding binding, int paramIdx)
Assert.NotNull(p);
Assert.IsType<ModelBinderParameterBinding>(p);
Assert.True(p.IsValid);
- Assert.False(p.WillReadBody);
+ Assert.False(p.WillReadBody);
}
// Assert that the binding contract says the given parameter will be bound to the cancellation token.
private void AssertIsCancellationToken(HttpActionBinding binding, int paramIdx)
{
- AssertIsCustomBinder<CancellationTokenParameterBinding>(binding, paramIdx);
+ AssertIsCustomBinder<CancellationTokenParameterBinding>(binding, paramIdx);
}
private void AssertIsError(HttpActionBinding binding, int paramIdx)
@@ -483,16 +483,16 @@ private void AssertIsError(HttpActionBinding binding, int paramIdx)
HttpParameterBinding p = binding.ParameterBindings[paramIdx];
Assert.NotNull(p);
Assert.False(p.IsValid);
- Assert.False(p.WillReadBody);
+ Assert.False(p.WillReadBody);
}
private void AssertIsCustomBinder<T>(HttpActionBinding binding, int paramIdx)
- {
+ {
HttpParameterBinding p = binding.ParameterBindings[paramIdx];
Assert.NotNull(p);
Assert.IsType<T>(p);
Assert.True(p.IsValid);
- Assert.False(p.WillReadBody);
+ Assert.False(p.WillReadBody);
}
@@ -503,10 +503,10 @@ private HttpActionDescriptor GetAction(string name)
}
private HttpActionDescriptor GetAction(string name, HttpConfiguration config)
- {
+ {
MethodInfo method = this.GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
Assert.NotNull(method);
- return new ReflectedHttpActionDescriptor { MethodInfo = method, Configuration = config, ControllerDescriptor = GetControllerDescriptor(config)};
+ return new ReflectedHttpActionDescriptor { MethodInfo = method, Configuration = config, ControllerDescriptor = GetControllerDescriptor(config) };
}
// Get a controller descriptor that's sufficiently initialized to use with parameter binding
@@ -587,5 +587,5 @@ public override IValueProvider GetValueProvider(HttpActionContext actionContext)
throw new NotImplementedException();
}
}
- }
+ }
}
12 test/System.Web.Http.Test/Services/ControllerServicesTests.cs
View
@@ -2,21 +2,9 @@
using System.Collections.Generic;
using System.Linq;
-using System.Net.Http.Formatting;
using System.Web.Http.Controllers;
using System.Web.Http.Dependencies;
-using System.Web.Http.Description;
-using System.Web.Http.Dispatcher;
-using System.Web.Http.Filters;
-using System.Web.Http.Metadata;
-using System.Web.Http.Metadata.Providers;
-using System.Web.Http.ModelBinding;
-using System.Web.Http.ModelBinding.Binders;
-using System.Web.Http.Tracing;
-using System.Web.Http.Validation;
-using System.Web.Http.Validation.Providers;
using System.Web.Http.ValueProviders;
-using System.Web.Http.ValueProviders.Providers;
using Moq;
using Xunit;
using Assert = Microsoft.TestCommon.AssertEx;
18 test/System.Web.Http.Test/Tracing/FormattingUtilitiesTest.cs
View
@@ -55,8 +55,8 @@ public void ActionArgumentsToString_Formats()
{"p2", true}
};
- string expected = String.Format("p1={0}, p2={1}",
- FormattingUtilities.ValueToString(arguments["p1"], CultureInfo.CurrentCulture),
+ string expected = String.Format("p1={0}, p2={1}",
+ FormattingUtilities.ValueToString(arguments["p1"], CultureInfo.CurrentCulture),
FormattingUtilities.ValueToString(arguments["p2"], CultureInfo.CurrentCulture));
// Act
@@ -164,8 +164,8 @@ public void FormattersToString_Formats()
public void ModelBinderToString_Formats()
{
// Arrange
- ModelBinderProvider provider = new SimpleModelBinderProvider(typeof (int), () => null);
- string expected = typeof (SimpleModelBinderProvider).Name;
+ ModelBinderProvider provider = new SimpleModelBinderProvider(typeof(int), () => null);
+ string expected = typeof(SimpleModelBinderProvider).Name;
// Act
string actual = FormattingUtilities.ModelBinderToString(provider);
@@ -182,8 +182,8 @@ public void ModelBinderToString_With_CompositeModelBinder_Formats()
ModelBinderProvider innerProvider2 = new ArrayModelBinderProvider();
CompositeModelBinderProvider compositeProvider = new CompositeModelBinderProvider(new ModelBinderProvider[] { innerProvider1, innerProvider2 });
string expected = String.Format(
- "{0}({1}, {2})",
- typeof(CompositeModelBinderProvider).Name,
+ "{0}({1}, {2})",
+ typeof(CompositeModelBinderProvider).Name,
typeof(SimpleModelBinderProvider).Name,
typeof(ArrayModelBinderProvider).Name);
@@ -220,8 +220,8 @@ public void ValueProviderToString_With_CompositeProvider_Formats()
CompositeValueProvider compositeProvider = new CompositeValueProvider(providers);
string expected = String.Format(
- "{0}({1}, {2})",
- typeof(CompositeValueProvider).Name,
+ "{0}({1}, {2})",
+ typeof(CompositeValueProvider).Name,
typeof(ElementalValueProvider).Name,
typeof(NameValuePairsValueProvider).Name);
@@ -241,7 +241,7 @@ public void RouteToString_Formats()
{"r1", "c1"},
{"r2", "c2"}
};
- Mock<IHttpRouteData> mockRouteData = new Mock<IHttpRouteData>() { CallBase = true};
+ Mock<IHttpRouteData> mockRouteData = new Mock<IHttpRouteData>() { CallBase = true };
mockRouteData.Setup(r => r.Values).Returns(routeDictionary);
string expected = "r1:c1,r2:c2";
2  test/System.Web.Http.Test/Tracing/TraceManagerTest.cs
View
@@ -21,7 +21,7 @@ public void TraceManager_Is_In_Default_ServiceResolver()
HttpConfiguration config = new HttpConfiguration();
// Act
- ITraceManager traceManager = config.Services.GetService(typeof (ITraceManager)) as ITraceManager;
+ ITraceManager traceManager = config.Services.GetService(typeof(ITraceManager)) as ITraceManager;
// Assert
Assert.IsType<TraceManager>(traceManager);
14 test/System.Web.Http.Test/Tracing/Tracers/BufferedMediaTypeFormatterTracerTest.cs
View
@@ -3,7 +3,6 @@
using System.IO;
using System.Net.Http;
using System.Net.Http.Formatting;
-using System.Net.Http.Headers;
using Moq;
using Xunit;
using Assert = Microsoft.TestCommon.AssertEx;
@@ -36,9 +35,8 @@ public void ReadFromStream_Traces()
{
// Arrange
Mock<BufferedMediaTypeFormatter> mockFormatter = new Mock<BufferedMediaTypeFormatter>() { CallBase = true };
- mockFormatter.Setup(
- f => f.ReadFromStream(It.IsAny<Type>(), It.IsAny<Stream>(), It.IsAny<HttpContent>(), It.IsAny<IFormatterLogger>())).
- Returns("sampleValue");
+ mockFormatter.Setup(f => f.ReadFromStream(It.IsAny<Type>(), It.IsAny<Stream>(), It.IsAny<HttpContent>(), It.IsAny<IFormatterLogger>()))
+ .Returns("sampleValue");
TestTraceWriter traceWriter = new TestTraceWriter();
HttpRequestMessage request = new HttpRequestMessage();
request.Content = new StringContent("");
@@ -115,11 +113,9 @@ public void WriteToStream_Traces_And_Throws_When_Inner_Throws()
// Arrange
InvalidOperationException exception = new InvalidOperationException("test");
Mock<BufferedMediaTypeFormatter> mockFormatter = new Mock<BufferedMediaTypeFormatter>() { CallBase = true };
- mockFormatter.Setup(
- f =>
- f.WriteToStream(It.IsAny<Type>(), It.IsAny<Object>(), It.IsAny<Stream>(),
- It.IsAny<HttpContent>())).
- Throws(exception);
+ mockFormatter.Setup(f => f.WriteToStream(It.IsAny<Type>(), It.IsAny<Object>(), It.IsAny<Stream>(),
+ It.IsAny<HttpContent>()))
+ .Throws(exception);
TestTraceWriter traceWriter = new TestTraceWriter();
HttpRequestMessage request = new HttpRequestMessage();
5 test/System.Web.Http.Test/Tracing/Tracers/ExceptionFilterTracerTest.cs
View
@@ -19,9 +19,8 @@ public void ExecuteExceptionFilterAsync_Traces()
HttpRequestMessage request = new HttpRequestMessage();
HttpResponseMessage response = new HttpResponseMessage();
Mock<IExceptionFilter> mockFilter = new Mock<IExceptionFilter>() { CallBase = true };
- mockFilter.Setup(
- f => f.ExecuteExceptionFilterAsync(It.IsAny<HttpActionExecutedContext>(), It.IsAny<CancellationToken>())).
- Returns(TaskHelpers.Completed());
+ mockFilter.Setup(f => f.ExecuteExceptionFilterAsync(It.IsAny<HttpActionExecutedContext>(), It.IsAny<CancellationToken>()))
+ .Returns(TaskHelpers.Completed());
HttpActionExecutedContext actionExecutedContext = ContextUtil.GetActionExecutedContext(request, response);
TestTraceWriter traceWriter = new TestTraceWriter();
ExceptionFilterTracer tracer = new ExceptionFilterTracer(mockFilter.Object, traceWriter);
2  test/System.Web.Http.Test/Tracing/Tracers/FilterTracerTest.cs
View
@@ -230,7 +230,7 @@ public void CreateFilterTracers_With_AuthorizationFilterAttribute_Returns_2_Wrap
// Assert
Assert.Equal(1, wrappedFilters.Length);
- Assert.IsType<AuthorizationFilterAttributeTracer>(wrappedFilters[0].Instance); ;
+ Assert.IsType<AuthorizationFilterAttributeTracer>(wrappedFilters[0].Instance);
}
[Fact]
2  test/System.Web.Http.Test/Tracing/Tracers/FormatterParameterBindingTracerTest.cs
View
@@ -104,7 +104,7 @@ public void ExecuteBindingAsync_Traces_And_Invokes_Inner_ReadAsync()
// Arrange
Mock<HttpParameterDescriptor> mockParamDescriptor = new Mock<HttpParameterDescriptor>() { CallBase = true };
mockParamDescriptor.Setup(d => d.ParameterName).Returns("paramName");
- mockParamDescriptor.Setup(d => d.ParameterType).Returns(typeof (string));
+ mockParamDescriptor.Setup(d => d.ParameterType).Returns(typeof(string));
FormatterParameterBinding binding = new FormatterParameterBinding(mockParamDescriptor.Object, new MediaTypeFormatterCollection(), null);
TestTraceWriter traceWriter = new TestTraceWriter();
FormatterParameterBindingTracer tracer = new FormatterParameterBindingTracer(binding, traceWriter);
12 test/System.Web.Http.Test/Tracing/Tracers/HttpActionBindingTracerTest.cs
View
@@ -71,10 +71,8 @@ public void BindValuesAsync_Invokes_Inner_And_Traces()
// Arrange
bool wasInvoked = false;
Mock<HttpActionBinding> mockBinder = new Mock<HttpActionBinding>() { CallBase = true };
- mockBinder.Setup(b => b.ExecuteBindingAsync(
- It.IsAny<HttpActionContext>(),
- It.IsAny<CancellationToken>())).
- Callback(() => wasInvoked = true).Returns(TaskHelpers.Completed());
+ mockBinder.Setup(b => b.ExecuteBindingAsync(It.IsAny<HttpActionContext>(), It.IsAny<CancellationToken>()))
+ .Callback(() => wasInvoked = true).Returns(TaskHelpers.Completed());
TestTraceWriter traceWriter = new TestTraceWriter();
HttpActionBindingTracer tracer = new HttpActionBindingTracer(mockBinder.Object, traceWriter);
@@ -101,10 +99,8 @@ public void ExecuteBindingAsync_Faults_And_Traces_When_Inner_Faults()
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
tcs.TrySetException(exception);
Mock<HttpActionBinding> mockBinder = new Mock<HttpActionBinding>() { CallBase = true };
- mockBinder.Setup(b => b.ExecuteBindingAsync(
- It.IsAny<HttpActionContext>(),
- It.IsAny<CancellationToken>())).
- Returns(tcs.Task);
+ mockBinder.Setup(b => b.ExecuteBindingAsync(It.IsAny<HttpActionContext>(), It.IsAny<CancellationToken>()))
+ .Returns(tcs.Task);
TestTraceWriter traceWriter = new TestTraceWriter();
HttpActionBindingTracer tracer = new HttpActionBindingTracer(mockBinder.Object, traceWriter);
1  test/System.Web.Http.Test/Tracing/Tracers/HttpControllerDescriptorTracerTest.cs
View
@@ -3,7 +3,6 @@
using System.Collections.Concurrent;
using System.Net.Http;
using System.Web.Http.Controllers;
-using System.Web.Http.Dispatcher;
using Moq;
using Xunit;
11 test/System.Web.Http.Test/Tracing/Tracers/MessageHandlerTracerTest.cs
View
@@ -32,12 +32,12 @@ public void SendAsync_Traces_And_Invokes_Inner()
new TraceRecord(request, TraceCategories.MessageHandlersCategory, TraceLevel.Info) { Kind = TraceKind.End, Operation = "SendAsync" }
};
- MethodInfo method = typeof (DelegatingHandler).GetMethod("SendAsync",
+ MethodInfo method = typeof(DelegatingHandler).GetMethod("SendAsync",
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance);
// Act
- Task<HttpResponseMessage> task = method.Invoke(tracer, new object[] {request, CancellationToken.None}) as Task<HttpResponseMessage>;
+ Task<HttpResponseMessage> task = method.Invoke(tracer, new object[] { request, CancellationToken.None }) as Task<HttpResponseMessage>;
HttpResponseMessage actualResponse = task.Result;
// Assert
@@ -74,7 +74,7 @@ public void SendAsync_Traces_And_Throws_When_Inner_Thr