From 6d9aa281c57b0781d8024d8e1739b2aeb97cc6f7 Mon Sep 17 00:00:00 2001 From: Artak Mkrtchyan Date: Tue, 17 Jul 2018 14:28:53 -0700 Subject: [PATCH 1/2] Render `maxlength` attribute for an input tag, when MaxLength or StringLength validation attributes are applied to the model class. --- .../MvcViewOptions.cs | 16 ++ .../ViewFeatures/DefaultHtmlGenerator.cs | 62 ++++++ ...iewOptionsConfigureCompatibilityOptions.cs | 5 + .../ViewFeatures/DefaultHtmlGeneratorTest.cs | 184 +++++++++++++++++- 4 files changed, 266 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewOptions.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewOptions.cs index 9d0627da96..237777da23 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewOptions.cs @@ -4,6 +4,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.ViewEngines; @@ -17,15 +18,18 @@ namespace Microsoft.AspNetCore.Mvc public class MvcViewOptions : IEnumerable { private readonly CompatibilitySwitch _suppressTempDataAttributePrefix; + private readonly CompatibilitySwitch _allowRenderingMaxLengthAttribute; private readonly ICompatibilitySwitch[] _switches; private HtmlHelperOptions _htmlHelperOptions = new HtmlHelperOptions(); public MvcViewOptions() { _suppressTempDataAttributePrefix = new CompatibilitySwitch(nameof(SuppressTempDataAttributePrefix)); + _allowRenderingMaxLengthAttribute = new CompatibilitySwitch(nameof(AllowRenderingMaxLengthAttribute)); _switches = new[] { _suppressTempDataAttributePrefix, + _allowRenderingMaxLengthAttribute }; } @@ -87,6 +91,18 @@ namespace Microsoft.AspNetCore.Mvc set => _suppressTempDataAttributePrefix.Value = value; } + /// + /// Gets or sets a value that indicates whether the maxlength attribute should be rendered for compatible HTML elements, + /// when they're bound to models marked with either + /// or attributes. + /// + /// If both attributes are specified, the one with the smaller value will be used for the rendered `maxlength` attribute. + public bool AllowRenderingMaxLengthAttribute + { + get => _allowRenderingMaxLengthAttribute.Value; + set => _allowRenderingMaxLengthAttribute.Value = value; + } + /// /// Gets a list s used by this application. /// diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGenerator.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGenerator.cs index e502341da4..d0121241b6 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGenerator.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/DefaultHtmlGenerator.cs @@ -4,6 +4,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Globalization; using System.Linq; @@ -30,6 +31,10 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures private static readonly string[] _placeholderInputTypes = new[] { "text", "search", "url", "tel", "email", "password", "number" }; + // See: (http://www.w3.org/TR/html5/sec-forms.html#apply) + private static readonly string[] _maxLengthInputTypes = + new[] { "text", "search", "url", "tel", "email", "password" }; + private readonly IAntiforgery _antiforgery; private readonly IModelMetadataProvider _metadataProvider; private readonly IUrlHelperFactory _urlHelperFactory; @@ -92,8 +97,18 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures // Underscores are fine characters in id's. IdAttributeDotReplacement = optionsAccessor.Value.HtmlHelperOptions.IdAttributeDotReplacement; + + AllowRenderingMaxLengthAttribute = optionsAccessor.Value.AllowRenderingMaxLengthAttribute; } + /// + /// Gets or sets a value that indicates whether the maxlength attribute should be rendered for compatible HTML input elements, + /// when they're bound to models marked with either + /// or attributes. + /// + /// If both attributes are specified, the one with the smaller value will be used for the rendered `maxlength` attribute. + protected bool AllowRenderingMaxLengthAttribute { get; } + /// public string IdAttributeDotReplacement { get; } @@ -724,6 +739,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures } AddPlaceholderAttribute(viewContext.ViewData, tagBuilder, modelExplorer, expression); + if (AllowRenderingMaxLengthAttribute) + { + AddMaxLengthAttribute(viewContext.ViewData, tagBuilder, modelExplorer, expression); + } + AddValidationAttributes(viewContext, tagBuilder, modelExplorer, expression); // If there are any errors for a named field, we add this CSS attribute. @@ -1239,6 +1259,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures AddPlaceholderAttribute(viewContext.ViewData, tagBuilder, modelExplorer, expression); } + if (AllowRenderingMaxLengthAttribute && _maxLengthInputTypes.Contains(suppliedTypeString)) + { + AddMaxLengthAttribute(viewContext.ViewData, tagBuilder, modelExplorer, expression); + } + var valueParameter = FormatValue(value, format); var usedModelState = false; switch (inputType) @@ -1373,6 +1398,43 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures } } + /// + /// Adds a maxlength attribute to the . + /// + /// A instance for the current scope. + /// A instance. + /// The for the . + /// Expression name, relative to the current model. + protected virtual void AddMaxLengthAttribute( + ViewDataDictionary viewData, + TagBuilder tagBuilder, + ModelExplorer modelExplorer, + string expression) + { + modelExplorer = modelExplorer ?? ExpressionMetadataProvider.FromStringExpression( + expression, + viewData, + _metadataProvider); + + int? maxLengthValue = null; + foreach (var attribute in modelExplorer.Metadata.ValidatorMetadata) + { + if (attribute is MaxLengthAttribute maxLengthAttribute && (!maxLengthValue.HasValue || maxLengthValue.Value > maxLengthAttribute.Length)) + { + maxLengthValue = maxLengthAttribute.Length; + } + else if (attribute is StringLengthAttribute stringLengthAttribute && (!maxLengthValue.HasValue || maxLengthValue.Value > stringLengthAttribute.MaximumLength)) + { + maxLengthValue = stringLengthAttribute.MaximumLength; + } + } + + if (maxLengthValue.HasValue) + { + tagBuilder.MergeAttribute("maxlength", maxLengthValue.Value.ToString()); + } + } + /// /// Adds validation attributes to the if client validation /// is enabled. diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MvcViewOptionsConfigureCompatibilityOptions.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MvcViewOptionsConfigureCompatibilityOptions.cs index 81de59fe12..b17210f7de 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MvcViewOptionsConfigureCompatibilityOptions.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/MvcViewOptionsConfigureCompatibilityOptions.cs @@ -28,6 +28,11 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures values[nameof(MvcViewOptions.SuppressTempDataAttributePrefix)] = true; } + if (Version >= CompatibilityVersion.Version_2_2) + { + values[nameof(MvcViewOptions.AllowRenderingMaxLengthAttribute)] = true; + } + return values; } } diff --git a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs index d4e5477aab..0d38ca3674 100644 --- a/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.ViewFeatures.Test/ViewFeatures/DefaultHtmlGeneratorTest.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.IO; using System.Linq; using System.Text.Encodings.Web; @@ -190,6 +191,169 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures Assert.Equal(expected, attribute.Value); } + [Theory] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithMaxLength), ModelWithMaxLengthMetadata.MaxLengthAttributeValue)] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithStringLength), ModelWithMaxLengthMetadata.StringLengthAttributeValue)] + public void GenerateTextArea_RendersMaxLength(string expression, int expectedValue) + { + // Arrange + var metadataProvider = new TestModelMetadataProvider(); + var htmlGenerator = GetGenerator(metadataProvider); + var viewContext = GetViewContext(model: null, metadataProvider: metadataProvider); + var modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression); + var modelExplorer = new ModelExplorer(metadataProvider, modelMetadata, null); + var htmlAttributes = new Dictionary + { + { "name", "testElement" }, + }; + + // Act + var tagBuilder = htmlGenerator.GenerateTextArea(viewContext, modelExplorer, expression, rows: 1, columns: 1, htmlAttributes); + + // Assert + var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); + Assert.Equal(expectedValue, Int32.Parse(attribute.Value)); + } + + [Theory] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithMaxLength), ModelWithMaxLengthMetadata.MaxLengthAttributeValue)] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithStringLength), ModelWithMaxLengthMetadata.StringLengthAttributeValue)] + public void GeneratePassword_RendersMaxLength(string expression, int expectedValue) + { + // Arrange + var metadataProvider = new TestModelMetadataProvider(); + var htmlGenerator = GetGenerator(metadataProvider); + var viewContext = GetViewContext(model: null, metadataProvider: metadataProvider); + var modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression); + var modelExplorer = new ModelExplorer(metadataProvider, modelMetadata, null); + var htmlAttributes = new Dictionary + { + { "name", "testElement" }, + }; + + // Act + var tagBuilder = htmlGenerator.GeneratePassword(viewContext, modelExplorer, expression, null, htmlAttributes); + + // Assert + var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); + Assert.Equal(expectedValue, Int32.Parse(attribute.Value)); + } + + [Theory] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithMaxLength), ModelWithMaxLengthMetadata.MaxLengthAttributeValue)] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithStringLength), ModelWithMaxLengthMetadata.StringLengthAttributeValue)] + public void GenerateTextBox_RendersMaxLength(string expression, int expectedValue) + { + // Arrange + var metadataProvider = new TestModelMetadataProvider(); + var htmlGenerator = GetGenerator(metadataProvider); + var viewContext = GetViewContext(model: null, metadataProvider: metadataProvider); + var modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression); + var modelExplorer = new ModelExplorer(metadataProvider, modelMetadata, null); + var htmlAttributes = new Dictionary + { + { "name", "testElement" }, + }; + + // Act + var tagBuilder = htmlGenerator.GenerateTextBox(viewContext, modelExplorer, expression, null, null, htmlAttributes); + + // Assert + var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); + Assert.Equal(expectedValue, Int32.Parse(attribute.Value)); + } + + [Fact] + public void GenerateTextBox_RendersMaxLength_WithMinimumValueFromBothAttributes() + { + // Arrange + var metadataProvider = new TestModelMetadataProvider(); + var htmlGenerator = GetGenerator(metadataProvider); + var viewContext = GetViewContext(model: null, metadataProvider: metadataProvider); + var modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), nameof(ModelWithMaxLengthMetadata.FieldWithBothAttributes)); + var modelExplorer = new ModelExplorer(metadataProvider, modelMetadata, null); + var htmlAttributes = new Dictionary + { + { "name", "testElement" }, + }; + + // Act + var tagBuilder = htmlGenerator.GenerateTextBox(viewContext, modelExplorer, nameof(ModelWithMaxLengthMetadata.FieldWithBothAttributes), null, null, htmlAttributes); + + // Assert + var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); + Assert.Equal(Math.Min(ModelWithMaxLengthMetadata.MaxLengthAttributeValue, ModelWithMaxLengthMetadata.StringLengthAttributeValue), Int32.Parse(attribute.Value)); + } + + [Fact] + public void GenerateTextBox_DoesNotRenderMaxLength_WhenNoAttributesPresent() + { + // Arrange + var metadataProvider = new TestModelMetadataProvider(); + var htmlGenerator = GetGenerator(metadataProvider); + var viewContext = GetViewContext(model: null, metadataProvider: metadataProvider); + var modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), nameof(ModelWithMaxLengthMetadata.FieldWithoutAttributes)); + var modelExplorer = new ModelExplorer(metadataProvider, modelMetadata, null); + var htmlAttributes = new Dictionary + { + { "name", "testElement" }, + }; + + // Act + var tagBuilder = htmlGenerator.GenerateTextBox(viewContext, modelExplorer, nameof(ModelWithMaxLengthMetadata.FieldWithoutAttributes), null, null, htmlAttributes); + + // Assert + Assert.DoesNotContain(tagBuilder.Attributes, a => a.Key == "maxlength"); + } + + [Theory] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithMaxLength), ModelWithMaxLengthMetadata.MaxLengthAttributeValue)] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithStringLength), ModelWithMaxLengthMetadata.StringLengthAttributeValue)] + public void GenerateTextBox_SearchType_RendersMaxLength(string expression, int expectedValue) + { + // Arrange + var metadataProvider = new TestModelMetadataProvider(); + var htmlGenerator = GetGenerator(metadataProvider); + var viewContext = GetViewContext(model: null, metadataProvider: metadataProvider); + var modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression); + var modelExplorer = new ModelExplorer(metadataProvider, modelMetadata, null); + var htmlAttributes = new Dictionary + { + { "name", "testElement" }, + { "type", "search"} + }; + + // Act + var tagBuilder = htmlGenerator.GenerateTextBox(viewContext, modelExplorer, expression, null, null, htmlAttributes); + + // Assert + var attribute = Assert.Single(tagBuilder.Attributes, a => a.Key == "maxlength"); + Assert.Equal(expectedValue, Int32.Parse(attribute.Value)); + } + + [Theory] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithMaxLength))] + [InlineData(nameof(ModelWithMaxLengthMetadata.FieldWithStringLength))] + public void GenerateHidden_DoesNotRenderMaxLength(string expression) + { + // Arrange + var metadataProvider = new TestModelMetadataProvider(); + var htmlGenerator = GetGenerator(metadataProvider); + var viewContext = GetViewContext(model: null, metadataProvider: metadataProvider); + var modelMetadata = metadataProvider.GetMetadataForProperty(typeof(ModelWithMaxLengthMetadata), expression); + var modelExplorer = new ModelExplorer(metadataProvider, modelMetadata, null); + var htmlAttributes = new Dictionary + { + { "name", "testElement" }, + }; + + // Act + var tagBuilder = htmlGenerator.GenerateHidden(viewContext, modelExplorer, expression, null, false, htmlAttributes); + + // Assert + Assert.DoesNotContain(tagBuilder.Attributes, a => a.Key == "maxlength"); + } + [Fact] public void GenerateValidationMessage_WithNullExpression_Throws() { @@ -759,7 +923,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures private static IHtmlGenerator GetGenerator(IModelMetadataProvider metadataProvider) { var mvcViewOptionsAccessor = new Mock>(); - mvcViewOptionsAccessor.SetupGet(accessor => accessor.Value).Returns(new MvcViewOptions()); + mvcViewOptionsAccessor.SetupGet(accessor => accessor.Value).Returns(new MvcViewOptions() { AllowRenderingMaxLengthAttribute = true }); var htmlEncoder = Mock.Of(); var antiforgery = new Mock(); @@ -820,6 +984,24 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures All = -1, } + private class ModelWithMaxLengthMetadata + { + internal const int MaxLengthAttributeValue = 77; + internal const int StringLengthAttributeValue = 7; + + [MaxLength(MaxLengthAttributeValue)] + public string FieldWithMaxLength { get; set; } + + [StringLength(StringLengthAttributeValue)] + public string FieldWithStringLength { get; set; } + + public string FieldWithoutAttributes { get; set; } + + [MaxLength(MaxLengthAttributeValue)] + [StringLength(StringLengthAttributeValue)] + public string FieldWithBothAttributes { get; set; } + } + private class Model { public int Id { get; set; } From 5a200379651e752b426057639792d0f8e603faf6 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 2 Aug 2018 11:08:39 -0700 Subject: [PATCH 2/2] Move API convention analyzers to Microsoft.AspNetCore.Mvc.Api.Analyzers Fixes #8153 --- Mvc.NoFun.sln | 35 ++++++++++++- Mvc.sln | 15 ++++++ .../CodeAnalysisExtensions.cs | 3 +- .../DiagnosticDescriptors.cs | 38 -------------- .../ActualApiResponseMetadata.cs | 2 +- .../AddResponseTypeAttributeCodeFixAction.cs | 6 +-- ...AddResponseTypeAttributeCodeFixProvider.cs | 10 ++-- ...ireExplicitModelValidationCheckAnalyzer.cs | 6 +-- ...eExplicitModelValidationCodeFixProvider.cs | 6 +-- .../ApiControllerFacts.cs | 7 ++- .../ApiControllerSymbolCache.cs | 34 ++++++------- .../ApiConventionAnalyzer.cs | 14 +++--- .../ApiDiagnosticDescriptors.cs | 48 ++++++++++++++++++ .../ApiSymbolNames.cs | 36 +++++++++++++ .../DeclaredApiResponseMetadata.cs | 2 +- ...rosoft.AspNetCore.Mvc.Api.Analyzers.csproj | 50 +++++++++++++++++++ ...rosoft.AspNetCore.Mvc.Api.Analyzers.nuspec | 24 +++++++++ .../MvcFacts.cs | 2 +- .../Properties/AssemblyInfo.cs | 6 +++ .../SymbolApiConventionMatcher.cs | 2 +- .../SymbolApiResponseMetadataProvider.cs | 2 +- ...ouldNotBeAppliedToPageModelAnalyzerTest.cs | 1 - .../AvoidHtmlPartialAnalyzerTest.cs | 1 - .../CodeAnalysisExtensionsTest.cs | 1 - .../MvcDiagnosticAnalyzerRunner.cs | 2 +- .../Infrastructure/MvcTestSource.cs | 2 +- ...AttributeCodeFixProviderIntegrationTest.cs | 4 +- ...lValidationCheckAnalyzerIntegrationTest.cs | 5 +- ...ModelValidationCheckCodeFixProviderTest.cs | 3 +- .../ApiControllerFactsTest.cs | 3 +- .../ApiConventionAnalyzerIntegrationTest.cs | 31 ++++++------ .../Mvc.Api.Analyzers.Test.csproj | 22 ++++++++ .../MvcFactsTest.cs | 3 +- .../SymbolApiConventionMatcherTest.cs | 5 +- .../SymbolApiResponseMetadataProviderTest.cs | 5 +- ...ullyQualifiedProducesResponseType.Input.cs | 0 ...llyQualifiedProducesResponseType.Output.cs | 0 .../CodeFixAddsMissingStatusCodes.Input.cs | 2 +- .../CodeFixAddsMissingStatusCodes.Output.cs | 2 +- .../CodeFixAddsStatusCodes.Input.cs | 2 +- .../CodeFixAddsStatusCodes.Output.cs | 2 +- .../CodeFixAddsSuccessStatusCode.Input.cs | 2 +- .../CodeFixAddsSuccessStatusCode.Output.cs | 2 +- ...hConventionAddsMissingStatusCodes.Input.cs | 2 +- ...ConventionAddsMissingStatusCodes.Output.cs | 2 +- ...ntionMethodAddsMissingStatusCodes.Input.cs | 2 +- ...tionMethodAddsMissingStatusCodes.Output.cs | 2 +- ...urned_ForApiActionsWithModelStateChecks.cs | 2 +- ...ctionsWithModelStateChecksUsingEquality.cs | 2 +- ...tionsWithModelStateChecksWithoutBracing.cs | 2 +- ...rApiActionsCheckingAdditionalConditions.cs | 2 +- ...urning400FromNonModelStateIsValidBlocks.cs | 2 +- ...ningNot400FromNonModelStateIsValidBlock.cs | 2 +- ...ed_ForApiActionsWithoutModelStateChecks.cs | 2 +- ...gnosticsAreReturned_ForNonApiController.cs | 2 +- ...agnosticsAreReturned_ForRazorPageModels.cs | 2 +- ...odeFixRemovesIfBlockWithoutBraces.Input.cs | 2 +- ...deFixRemovesIfBlockWithoutBraces.Output.cs | 2 +- ...teIsInvalidBlockWithEqualityCheck.Input.cs | 2 +- ...eIsInvalidBlockWithEqualityCheck.Output.cs | 2 +- ...StateIsInvalidBlockWithIfNotCheck.Input.cs | 2 +- ...tateIsInvalidBlockWithIfNotCheck.Output.cs | 2 +- .../ApiControllerFactsTest/TestFile.cs | 2 +- ...tOfTReturningMethodWithoutAnyAttributes.cs | 2 +- ...OfTReturningMethodWithoutSomeAttributes.cs | 2 +- ...urned_ForControllerWithCustomConvention.cs | 4 +- ...Attribute_ReturnsUndocumentedStatusCode.cs | 2 +- ...Attribute_ReturnsUndocumentedStatusCode.cs | 2 +- ...ionMethod_ReturnsUndocumentedStatusCode.cs | 2 +- ...nouslyReturnsValue_WithoutDocumentation.cs | 2 +- ...ributeReturnsValue_WithoutDocumentation.cs | 2 +- ...fMethodWithAttribute_ReturnsDerivedType.cs | 2 +- ...ntion_DoesNotReturnDocumentedStatusCode.cs | 2 +- ...onvention_ReturnsUndocumentedStatusCode.cs | 4 +- ...ribute_DoesNotDocumentSuccessStatusCode.cs | 2 +- ...ibute_DoesNotReturnDocumentedStatusCode.cs | 2 +- ...Attribute_ReturnsUndocumentedStatusCode.cs | 2 +- ...ontroller_IfStatusCodesCannotBeInferred.cs | 2 +- ...Controller_WithAllDocumentedStatusCodes.cs | 2 +- ...gnosticsAreReturned_ForNonApiController.cs | 2 +- ...agnosticsAreReturned_ForRazorPageModels.cs | 2 +- ...reReturned_ForReturnStatementsInLambdas.cs | 2 +- ...ned_ForReturnStatementsInLocalFunctions.cs | 2 +- .../MvcFactsTest/IsControllerActionTests.cs | 2 +- .../MvcFactsTest/IsControllerTests.cs | 2 +- .../SymbolApiConventionMatcherTestFile.cs | 2 +- .../GetDefaultStatusCodeTest.cs | 2 +- .../GetResponseMetadataTests.cs | 2 +- ...etadata_IfReturnedTypeIsNotActionResult.cs | 2 +- ...efaultStatusCodeAttributeOnActionResult.cs | 2 +- 90 files changed, 362 insertions(+), 184 deletions(-) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/ActualApiResponseMetadata.cs (94%) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/AddResponseTypeAttributeCodeFixAction.cs (96%) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/AddResponseTypeAttributeCodeFixProvider.cs (70%) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (97%) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs (88%) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/ApiControllerFacts.cs (79%) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/ApiControllerSymbolCache.cs (68%) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/ApiConventionAnalyzer.cs (88%) create mode 100644 src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiDiagnosticDescriptors.cs create mode 100644 src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiSymbolNames.cs rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/DeclaredApiResponseMetadata.cs (98%) create mode 100644 src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj create mode 100644 src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.nuspec rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/MvcFacts.cs (98%) create mode 100644 src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Properties/AssemblyInfo.cs rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/SymbolApiConventionMatcher.cs (99%) rename src/{Microsoft.AspNetCore.Mvc.Analyzers => Microsoft.AspNetCore.Mvc.Api.Analyzers}/SymbolApiResponseMetadataProvider.cs (99%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/AddResponseTypeAttributeCodeFixProviderIntegrationTest.cs (95%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest.cs (93%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest.cs (95%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/ApiControllerFactsTest.cs (97%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/ApiConventionAnalyzerIntegrationTest.cs (79%) create mode 100644 test/Mvc.Api.Analyzers.Test/Mvc.Api.Analyzers.Test.csproj rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/MvcFactsTest.cs (99%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/SymbolApiConventionMatcherTest.cs (99%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/SymbolApiResponseMetadataProviderTest.cs (99%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Input.cs (100%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Output.cs (100%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Input.cs (88%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Output.cs (90%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Input.cs (84%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Output.cs (87%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Input.cs (90%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Output.cs (92%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Input.cs (88%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Output.cs (90%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Input.cs (88%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Output.cs (88%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecks.cs (76%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksUsingEquality.cs (77%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksWithoutBracing.cs (74%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsCheckingAdditionalConditions.cs (75%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturning400FromNonModelStateIsValidBlocks.cs (72%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturningNot400FromNonModelStateIsValidBlock.cs (73%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsWithoutModelStateChecks.cs (69%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs (67%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs (68%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Input.cs (72%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Output.cs (67%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Input.cs (76%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Output.cs (70%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Input.cs (75%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Output.cs (70%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiControllerFactsTest/TestFile.cs (92%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes.cs (90%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes.cs (92%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForControllerWithCustomConvention.cs (92%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs (91%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs (91%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode.cs (90%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs (94%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation.cs (92%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType.cs (94%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode.cs (90%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode.cs (89%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode.cs (90%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode.cs (91%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs (88%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_IfStatusCodesCannotBeInferred.cs (85%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_WithAllDocumentedStatusCodes.cs (93%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs (87%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs (86%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLambdas.cs (94%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLocalFunctions.cs (93%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/MvcFactsTest/IsControllerActionTests.cs (97%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/MvcFactsTest/IsControllerTests.cs (95%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/SymbolApiConventionMatcherTest/SymbolApiConventionMatcherTestFile.cs (97%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/SymbolApiResponseMetadataProviderTest/GetDefaultStatusCodeTest.cs (87%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/SymbolApiResponseMetadataProviderTest/GetResponseMetadataTests.cs (98%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsDefaultResponseMetadata_IfReturnedTypeIsNotActionResult.cs (88%) rename test/{Mvc.Analyzers.Test => Mvc.Api.Analyzers.Test}/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsStatusCodeFromDefaultStatusCodeAttributeOnActionResult.cs (81%) diff --git a/Mvc.NoFun.sln b/Mvc.NoFun.sln index 445f77a303..d8e44d40bf 100644 --- a/Mvc.NoFun.sln +++ b/Mvc.NoFun.sln @@ -1,4 +1,5 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 + +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2036 MinimumVisualStudioVersion = 15.0.26730.03 @@ -114,7 +115,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mvc.Analyzers.Test", "test\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Views.TestCommon", "test\Microsoft.AspNetCore.Mvc.Views.TestCommon\Microsoft.AspNetCore.Mvc.Views.TestCommon.csproj", "{0772E545-A674-4165-9469-E3D79D88A4A8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.Mvc.Testing", "src\Microsoft.AspNetCore.Mvc.Testing\Microsoft.AspNetCore.Mvc.Testing.csproj", "{92D959F2-66B8-490A-BA33-DA4421EBC948}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Testing", "src\Microsoft.AspNetCore.Mvc.Testing\Microsoft.AspNetCore.Mvc.Testing.csproj", "{92D959F2-66B8-490A-BA33-DA4421EBC948}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Api.Analyzers", "src\Microsoft.AspNetCore.Mvc.Api.Analyzers\Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj", "{1B398182-9EAE-400B-A2BD-EFFAC0168A36}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mvc.Api.Analyzers.Test", "test\Mvc.Api.Analyzers.Test\Mvc.Api.Analyzers.Test.csproj", "{71C626FC-6408-494B-A127-38CB64F71324}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -574,6 +579,30 @@ Global {92D959F2-66B8-490A-BA33-DA4421EBC948}.Release|Mixed Platforms.Build.0 = Release|Any CPU {92D959F2-66B8-490A-BA33-DA4421EBC948}.Release|x86.ActiveCfg = Release|Any CPU {92D959F2-66B8-490A-BA33-DA4421EBC948}.Release|x86.Build.0 = Release|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Debug|x86.ActiveCfg = Debug|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Debug|x86.Build.0 = Debug|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Release|Any CPU.Build.0 = Release|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Release|x86.ActiveCfg = Release|Any CPU + {1B398182-9EAE-400B-A2BD-EFFAC0168A36}.Release|x86.Build.0 = Release|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Debug|x86.ActiveCfg = Debug|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Debug|x86.Build.0 = Debug|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Release|Any CPU.Build.0 = Release|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Release|x86.ActiveCfg = Release|Any CPU + {71C626FC-6408-494B-A127-38CB64F71324}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -618,6 +647,8 @@ Global {829D9A67-2D07-4CE6-86C0-59F2549B0CFA} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {0772E545-A674-4165-9469-E3D79D88A4A8} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {92D959F2-66B8-490A-BA33-DA4421EBC948} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} + {1B398182-9EAE-400B-A2BD-EFFAC0168A36} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E} + {71C626FC-6408-494B-A127-38CB64F71324} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D003597F-372F-4068-A2F0-353BE3C3B39A} diff --git a/Mvc.sln b/Mvc.sln index 77f80bb3e4..8223801973 100644 --- a/Mvc.sln +++ b/Mvc.sln @@ -176,6 +176,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicApi", "benchmarkapps\B EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BasicViews", "benchmarkapps\BasicViews\BasicViews.csproj", "{E89EB74D-C1CE-456F-B42D-CCF1575E0CFB}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mvc.Api.Analyzers.Test", "test\Mvc.Api.Analyzers.Test\Mvc.Api.Analyzers.Test.csproj", "{DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -924,6 +926,18 @@ Global {E89EB74D-C1CE-456F-B42D-CCF1575E0CFB}.Release|Mixed Platforms.Build.0 = Release|Any CPU {E89EB74D-C1CE-456F-B42D-CCF1575E0CFB}.Release|x86.ActiveCfg = Release|Any CPU {E89EB74D-C1CE-456F-B42D-CCF1575E0CFB}.Release|x86.Build.0 = Release|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Debug|x86.ActiveCfg = Debug|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Debug|x86.Build.0 = Debug|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Release|Any CPU.Build.0 = Release|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Release|x86.ActiveCfg = Release|Any CPU + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -995,6 +1009,7 @@ Global {51E3E785-A9D1-4196-BAFE-A17FF4304B89} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} {910F023A-88E3-4CB4-8793-AC4005C7B421} = {2859F266-673A-45A2-9E3C-7B39C6DDD38E} {E89EB74D-C1CE-456F-B42D-CCF1575E0CFB} = {2859F266-673A-45A2-9E3C-7B39C6DDD38E} + {DD7B9F20-354C-4D9E-8C8A-8AE6E7595A87} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {63D344F6-F86D-40E6-85B9-0AABBE338C4A} diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/CodeAnalysisExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Analyzers/CodeAnalysisExtensions.cs index 4211409bf4..7856b27b02 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/CodeAnalysisExtensions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Analyzers/CodeAnalysisExtensions.cs @@ -4,9 +4,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.CodeAnalysis { internal static class CodeAnalysisExtensions { diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/DiagnosticDescriptors.cs b/src/Microsoft.AspNetCore.Mvc.Analyzers/DiagnosticDescriptors.cs index f8c1b7bb72..b2684297bd 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/DiagnosticDescriptors.cs +++ b/src/Microsoft.AspNetCore.Mvc.Analyzers/DiagnosticDescriptors.cs @@ -42,43 +42,5 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers "Usage", DiagnosticSeverity.Warning, isEnabledByDefault: true); - - public static readonly DiagnosticDescriptor MVC1004_ActionReturnsUndocumentedStatusCode = - new DiagnosticDescriptor( - "MVC1004", - "Action returns undeclared status code.", - "Action method returns undeclared status code '{0}'.", - "Usage", - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - public static readonly DiagnosticDescriptor MVC1005_ActionReturnsUndocumentedSuccessResult = - new DiagnosticDescriptor( - "MVC1005", - "Action returns undeclared success result.", - "Action method returns a success result without a corresponding ProducesResponseType.", - "Usage", - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - public static readonly DiagnosticDescriptor MVC1006_ActionDoesNotReturnDocumentedStatusCode = - new DiagnosticDescriptor( - "MVC1006", - "Action documents status code that is not returned.", - "Action method documents status code '{0}' without a corresponding return type.", - "Usage", - DiagnosticSeverity.Info, - isEnabledByDefault: false); - - public static readonly DiagnosticDescriptor MVC1007_ApiActionsDoNotRequireExplicitModelValidationCheck = - new DiagnosticDescriptor( - "MVC1007", - "Action methods on ApiController instances do not require explicit model validation check.", - "Action methods on ApiController instances do not require explicit model validation check.", - "Usage", - DiagnosticSeverity.Info, - isEnabledByDefault: true, - customTags: new[] { WellKnownDiagnosticTags.Unnecessary }); - } } diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/ActualApiResponseMetadata.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ActualApiResponseMetadata.cs similarity index 94% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/ActualApiResponseMetadata.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ActualApiResponseMetadata.cs index 3772f290e7..15f790450e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/ActualApiResponseMetadata.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ActualApiResponseMetadata.cs @@ -3,7 +3,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { internal readonly struct ActualApiResponseMetadata { diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/AddResponseTypeAttributeCodeFixAction.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/AddResponseTypeAttributeCodeFixAction.cs similarity index 96% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/AddResponseTypeAttributeCodeFixAction.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/AddResponseTypeAttributeCodeFixAction.cs index 56f2373203..27a7ca1c35 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/AddResponseTypeAttributeCodeFixAction.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/AddResponseTypeAttributeCodeFixAction.cs @@ -13,7 +13,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Simplification; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { internal sealed class AddResponseTypeAttributeCodeFixAction : CodeAction { @@ -108,7 +108,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers private static AttributeSyntax CreateProducesResponseTypeAttribute(int statusCode) { return SyntaxFactory.Attribute( - SyntaxFactory.ParseName(SymbolNames.ProducesResponseTypeAttribute) + SyntaxFactory.ParseName(ApiSymbolNames.ProducesResponseTypeAttribute) .WithAdditionalAnnotations(Simplifier.Annotation), SyntaxFactory.AttributeArgumentList().AddArguments( SyntaxFactory.AttributeArgument( @@ -118,7 +118,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers private static AttributeSyntax CreateProducesDefaultResponseTypeAttribute() { return SyntaxFactory.Attribute( - SyntaxFactory.ParseName(SymbolNames.ProducesDefaultResponseTypeAttribute) + SyntaxFactory.ParseName(ApiSymbolNames.ProducesDefaultResponseTypeAttribute) .WithAdditionalAnnotations(Simplifier.Annotation)); } diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/AddResponseTypeAttributeCodeFixProvider.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/AddResponseTypeAttributeCodeFixProvider.cs similarity index 70% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/AddResponseTypeAttributeCodeFixProvider.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/AddResponseTypeAttributeCodeFixProvider.cs index fc69730061..a5a2a62613 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/AddResponseTypeAttributeCodeFixProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/AddResponseTypeAttributeCodeFixProvider.cs @@ -7,15 +7,15 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ExportCodeFixProvider(LanguageNames.CSharp)] [Shared] public class AddResponseTypeAttributeCodeFixProvider : CodeFixProvider { public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create( - DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode.Id, - DiagnosticDescriptors.MVC1005_ActionReturnsUndocumentedSuccessResult.Id); + ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode.Id, + ApiDiagnosticDescriptors.API1001_ActionReturnsUndocumentedSuccessResult.Id); public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { @@ -25,8 +25,8 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers } var diagnostic = context.Diagnostics[0]; - if ((diagnostic.Descriptor.Id != DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode.Id) && - (diagnostic.Descriptor.Id != DiagnosticDescriptors.MVC1005_ActionReturnsUndocumentedSuccessResult.Id)) + if ((diagnostic.Descriptor.Id != ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode.Id) && + (diagnostic.Descriptor.Id != ApiDiagnosticDescriptors.API1001_ActionReturnsUndocumentedSuccessResult.Id)) { return Task.CompletedTask; } diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs similarity index 97% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs index 0408513ced..e8b52c012e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs @@ -8,13 +8,13 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Operations; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer : DiagnosticAnalyzer { public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create( - DiagnosticDescriptors.MVC1007_ApiActionsDoNotRequireExplicitModelValidationCheck); + ApiDiagnosticDescriptors.API1003_ApiActionsDoNotRequireExplicitModelValidationCheck); public override void Initialize(AnalysisContext context) { @@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers operationAnalysisContext.ReportDiagnostic( Diagnostic.Create( - DiagnosticDescriptors.MVC1007_ApiActionsDoNotRequireExplicitModelValidationCheck, + ApiDiagnosticDescriptors.API1003_ApiActionsDoNotRequireExplicitModelValidationCheck, ifStatement.GetLocation(), additionalLocations: additionalLocations)); }, OperationKind.Conditional); diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs similarity index 88% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs index 3446de28a4..a9439c6884 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs @@ -11,14 +11,14 @@ using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Text; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ExportCodeFixProvider(LanguageNames.CSharp)] [Shared] public class ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray FixableDiagnosticIds => - ImmutableArray.Create(DiagnosticDescriptors.MVC1007_ApiActionsDoNotRequireExplicitModelValidationCheck.Id); + ImmutableArray.Create(ApiDiagnosticDescriptors.API1003_ApiActionsDoNotRequireExplicitModelValidationCheck.Id); public sealed override FixAllProvider GetFixAllProvider() => WellKnownFixAllProviders.BatchFixer; @@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers } var diagnostic = context.Diagnostics[0]; - if (diagnostic.Id != DiagnosticDescriptors.MVC1007_ApiActionsDoNotRequireExplicitModelValidationCheck.Id) + if (diagnostic.Id != ApiDiagnosticDescriptors.API1003_ApiActionsDoNotRequireExplicitModelValidationCheck.Id) { return Task.CompletedTask; } diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiControllerFacts.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiControllerFacts.cs similarity index 79% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/ApiControllerFacts.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiControllerFacts.cs index 48d81975ef..b947b8dc5d 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiControllerFacts.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiControllerFacts.cs @@ -1,6 +1,9 @@ -using Microsoft.CodeAnalysis; +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Mvc.Analyzers +using Microsoft.CodeAnalysis; + +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { internal static class ApiControllerFacts { diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiControllerSymbolCache.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiControllerSymbolCache.cs similarity index 68% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/ApiControllerSymbolCache.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiControllerSymbolCache.cs index 56097763d5..c2a6f167d2 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiControllerSymbolCache.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiControllerSymbolCache.cs @@ -4,35 +4,31 @@ using System; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { internal readonly struct ApiControllerSymbolCache { public ApiControllerSymbolCache(Compilation compilation) { - ActionResultOfT = compilation.GetTypeByMetadataName(SymbolNames.ActionResultOfT); - ApiConventionMethodAttribute = compilation.GetTypeByMetadataName(SymbolNames.ApiConventionMethodAttribute); - ApiConventionNameMatchAttribute = compilation.GetTypeByMetadataName(SymbolNames.ApiConventionNameMatchAttribute); - ApiConventionTypeAttribute = compilation.GetTypeByMetadataName(SymbolNames.ApiConventionTypeAttribute); - ApiConventionTypeMatchAttribute = compilation.GetTypeByMetadataName(SymbolNames.ApiConventionTypeMatchAttribute); - ControllerAttribute = compilation.GetTypeByMetadataName(SymbolNames.ControllerAttribute); - DefaultStatusCodeAttribute = compilation.GetTypeByMetadataName(SymbolNames.DefaultStatusCodeAttribute); - IActionResult = compilation.GetTypeByMetadataName(SymbolNames.IActionResult); - IApiBehaviorMetadata = compilation.GetTypeByMetadataName(SymbolNames.IApiBehaviorMetadata); - IConvertToActionResult = compilation.GetTypeByMetadataName(SymbolNames.IConvertToActionResult); - ModelStateDictionary = compilation.GetTypeByMetadataName(SymbolNames.ModelStateDictionary); - NonActionAttribute = compilation.GetTypeByMetadataName(SymbolNames.NonActionAttribute); - NonControllerAttribute = compilation.GetTypeByMetadataName(SymbolNames.NonControllerAttribute); - ProducesDefaultResponseTypeAttribute = compilation.GetTypeByMetadataName(SymbolNames.ProducesDefaultResponseTypeAttribute); - ProducesResponseTypeAttribute = compilation.GetTypeByMetadataName(SymbolNames.ProducesResponseTypeAttribute); + ApiConventionMethodAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.ApiConventionMethodAttribute); + ApiConventionNameMatchAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.ApiConventionNameMatchAttribute); + ApiConventionTypeAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.ApiConventionTypeAttribute); + ApiConventionTypeMatchAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.ApiConventionTypeMatchAttribute); + ControllerAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.ControllerAttribute); + DefaultStatusCodeAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.DefaultStatusCodeAttribute); + IActionResult = compilation.GetTypeByMetadataName(ApiSymbolNames.IActionResult); + IApiBehaviorMetadata = compilation.GetTypeByMetadataName(ApiSymbolNames.IApiBehaviorMetadata); + ModelStateDictionary = compilation.GetTypeByMetadataName(ApiSymbolNames.ModelStateDictionary); + NonActionAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.NonActionAttribute); + NonControllerAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.NonControllerAttribute); + ProducesDefaultResponseTypeAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.ProducesDefaultResponseTypeAttribute); + ProducesResponseTypeAttribute = compilation.GetTypeByMetadataName(ApiSymbolNames.ProducesResponseTypeAttribute); var disposable = compilation.GetSpecialType(SpecialType.System_IDisposable); var members = disposable.GetMembers(nameof(IDisposable.Dispose)); IDisposableDispose = members.Length == 1 ? (IMethodSymbol)members[0] : null; } - public INamedTypeSymbol ActionResultOfT { get; } - public INamedTypeSymbol ApiConventionMethodAttribute { get; } public INamedTypeSymbol ApiConventionNameMatchAttribute { get; } @@ -49,8 +45,6 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers public INamedTypeSymbol IApiBehaviorMetadata { get; } - public INamedTypeSymbol IConvertToActionResult { get; } - public IMethodSymbol IDisposableDispose { get; } public ITypeSymbol ModelStateDictionary { get; } diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiConventionAnalyzer.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiConventionAnalyzer.cs similarity index 88% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/ApiConventionAnalyzer.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiConventionAnalyzer.cs index 39d810f42e..27e5439330 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/ApiConventionAnalyzer.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiConventionAnalyzer.cs @@ -8,15 +8,15 @@ using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [DiagnosticAnalyzer(LanguageNames.CSharp)] public class ApiConventionAnalyzer : DiagnosticAnalyzer { public override ImmutableArray SupportedDiagnostics { get; } = ImmutableArray.Create( - DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, - DiagnosticDescriptors.MVC1005_ActionReturnsUndocumentedSuccessResult, - DiagnosticDescriptors.MVC1006_ActionDoesNotReturnDocumentedStatusCode); + ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, + ApiDiagnosticDescriptors.API1001_ActionReturnsUndocumentedSuccessResult, + ApiDiagnosticDescriptors.API1002_ActionDoesNotReturnDocumentedStatusCode); public override void Initialize(AnalysisContext context) { @@ -64,13 +64,13 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers if (actualMetadata.IsDefaultResponse) { syntaxNodeContext.ReportDiagnostic(Diagnostic.Create( - DiagnosticDescriptors.MVC1005_ActionReturnsUndocumentedSuccessResult, + ApiDiagnosticDescriptors.API1001_ActionReturnsUndocumentedSuccessResult, location)); } else { syntaxNodeContext.ReportDiagnostic(Diagnostic.Create( - DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, + ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, location, actualMetadata.StatusCode)); } @@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers if (!Contains(actualResponseMetadata, declaredMetadata)) { syntaxNodeContext.ReportDiagnostic(Diagnostic.Create( - DiagnosticDescriptors.MVC1006_ActionDoesNotReturnDocumentedStatusCode, + ApiDiagnosticDescriptors.API1002_ActionDoesNotReturnDocumentedStatusCode, methodSyntax.Identifier.GetLocation(), declaredMetadata.StatusCode)); } diff --git a/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiDiagnosticDescriptors.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiDiagnosticDescriptors.cs new file mode 100644 index 0000000000..ff56f64f1c --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiDiagnosticDescriptors.cs @@ -0,0 +1,48 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis; + +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers +{ + internal static class ApiDiagnosticDescriptors + { + public static readonly DiagnosticDescriptor API1000_ActionReturnsUndocumentedStatusCode = + new DiagnosticDescriptor( + "API1000", + "Action returns undeclared status code.", + "Action method returns undeclared status code '{0}'.", + "Usage", + DiagnosticSeverity.Warning, + isEnabledByDefault: true); + + public static readonly DiagnosticDescriptor API1001_ActionReturnsUndocumentedSuccessResult = + new DiagnosticDescriptor( + "API1001", + "Action returns undeclared success result.", + "Action method returns a success result without a corresponding ProducesResponseType.", + "Usage", + DiagnosticSeverity.Warning, + isEnabledByDefault: true); + + public static readonly DiagnosticDescriptor API1002_ActionDoesNotReturnDocumentedStatusCode = + new DiagnosticDescriptor( + "API1002", + "Action documents status code that is not returned.", + "Action method documents status code '{0}' without a corresponding return type.", + "Usage", + DiagnosticSeverity.Info, + isEnabledByDefault: false); + + public static readonly DiagnosticDescriptor API1003_ApiActionsDoNotRequireExplicitModelValidationCheck = + new DiagnosticDescriptor( + "API1003", + "Action methods on ApiController instances do not require explicit model validation check.", + "Action methods on ApiController instances do not require explicit model validation check.", + "Usage", + DiagnosticSeverity.Info, + isEnabledByDefault: true, + customTags: new[] { WellKnownDiagnosticTags.Unnecessary }); + + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiSymbolNames.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiSymbolNames.cs new file mode 100644 index 0000000000..9ec9bdfa0f --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/ApiSymbolNames.cs @@ -0,0 +1,36 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers +{ + internal static class ApiSymbolNames + { + public const string AllowAnonymousAttribute = "Microsoft.AspNetCore.Authorization.AllowAnonymousAttribute"; + + public const string ApiConventionMethodAttribute = "Microsoft.AspNetCore.Mvc.ApiConventionMethodAttribute"; + + public const string ApiConventionNameMatchAttribute = "Microsoft.AspNetCore.Mvc.ApiExplorer.ApiConventionNameMatchAttribute"; + + public const string ApiConventionTypeMatchAttribute = "Microsoft.AspNetCore.Mvc.ApiExplorer.ApiConventionTypeMatchAttribute"; + + public const string ApiConventionTypeAttribute = "Microsoft.AspNetCore.Mvc.ApiConventionTypeAttribute"; + + public const string ControllerAttribute = "Microsoft.AspNetCore.Mvc.ControllerAttribute"; + + public const string DefaultStatusCodeAttribute = "Microsoft.AspNetCore.Mvc.Infrastructure.DefaultStatusCodeAttribute"; + + public const string IApiBehaviorMetadata = "Microsoft.AspNetCore.Mvc.Internal.IApiBehaviorMetadata"; + + public const string IActionResult = "Microsoft.AspNetCore.Mvc.IActionResult"; + + public const string ModelStateDictionary = "Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary"; + + public const string NonActionAttribute = "Microsoft.AspNetCore.Mvc.NonActionAttribute"; + + public const string NonControllerAttribute = "Microsoft.AspNetCore.Mvc.NonControllerAttribute"; + + public const string ProducesDefaultResponseTypeAttribute = "Microsoft.AspNetCore.Mvc.ProducesDefaultResponseTypeAttribute"; + + public const string ProducesResponseTypeAttribute = "Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute"; + } +} diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/DeclaredApiResponseMetadata.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/DeclaredApiResponseMetadata.cs similarity index 98% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/DeclaredApiResponseMetadata.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/DeclaredApiResponseMetadata.cs index e2cbd6c994..a45b1ed573 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/DeclaredApiResponseMetadata.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/DeclaredApiResponseMetadata.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { internal readonly struct DeclaredApiResponseMetadata { diff --git a/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj new file mode 100644 index 0000000000..5081b0d502 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj @@ -0,0 +1,50 @@ + + + CSharp Analyzers for ASP.NET Core MVC. + aspnetcore;aspnetcoremvc + + netstandard1.3 + false + false + false + $(MSBuildProjectName).nuspec + + + + + + + + + + + + + + + + + + + true + + + id=$(PackageId); + version=$(PackageVersion); + authors=$(Authors); + description=$(Description); + tags=$(PackageTags.Replace(';', ' ')); + licenseUrl=$(PackageLicenseUrl); + projectUrl=$(PackageProjectUrl); + iconUrl=$(PackageIconUrl); + repositoryUrl=$(RepositoryUrl); + repositoryCommit=$(RepositoryCommit); + copyright=$(Copyright); + + OutputBinary=$(OutputPath)$(AssemblyName).dll; + OutputSymbol=$(OutputPath)$(AssemblyName).pdb; + + + + + diff --git a/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.nuspec b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.nuspec new file mode 100644 index 0000000000..5f9d436f73 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Microsoft.AspNetCore.Mvc.Api.Analyzers.nuspec @@ -0,0 +1,24 @@ + + + + $id$ + $version$ + $authors$ + true + $licenseUrl$ + $projectUrl$ + $iconUrl$ + $description$ + $copyright$ + $tags$ + + + + + + + + + + + diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/MvcFacts.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/MvcFacts.cs similarity index 98% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/MvcFacts.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/MvcFacts.cs index 90651247c4..a5dfe71dcc 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/MvcFacts.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/MvcFacts.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { internal static class MvcFacts { diff --git a/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..1ed7ae5ed2 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Mvc.Api.Analyzers.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/SymbolApiConventionMatcher.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/SymbolApiConventionMatcher.cs similarity index 99% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/SymbolApiConventionMatcher.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/SymbolApiConventionMatcher.cs index 878d0189e9..78078cfcd0 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/SymbolApiConventionMatcher.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/SymbolApiConventionMatcher.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using Microsoft.CodeAnalysis; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { internal static class SymbolApiConventionMatcher { diff --git a/src/Microsoft.AspNetCore.Mvc.Analyzers/SymbolApiResponseMetadataProvider.cs b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/SymbolApiResponseMetadataProvider.cs similarity index 99% rename from src/Microsoft.AspNetCore.Mvc.Analyzers/SymbolApiResponseMetadataProvider.cs rename to src/Microsoft.AspNetCore.Mvc.Api.Analyzers/SymbolApiResponseMetadataProvider.cs index 545955782f..5de70bae0a 100644 --- a/src/Microsoft.AspNetCore.Mvc.Analyzers/SymbolApiResponseMetadataProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Api.Analyzers/SymbolApiResponseMetadataProvider.cs @@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { internal static class SymbolApiResponseMetadataProvider { diff --git a/test/Mvc.Analyzers.Test/AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs b/test/Mvc.Analyzers.Test/AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs index 1bb389e166..baac0e3b4f 100644 --- a/test/Mvc.Analyzers.Test/AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs +++ b/test/Mvc.Analyzers.Test/AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs @@ -4,7 +4,6 @@ using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; diff --git a/test/Mvc.Analyzers.Test/AvoidHtmlPartialAnalyzerTest.cs b/test/Mvc.Analyzers.Test/AvoidHtmlPartialAnalyzerTest.cs index b6de06c5fa..cac606e97c 100644 --- a/test/Mvc.Analyzers.Test/AvoidHtmlPartialAnalyzerTest.cs +++ b/test/Mvc.Analyzers.Test/AvoidHtmlPartialAnalyzerTest.cs @@ -4,7 +4,6 @@ using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; diff --git a/test/Mvc.Analyzers.Test/CodeAnalysisExtensionsTest.cs b/test/Mvc.Analyzers.Test/CodeAnalysisExtensionsTest.cs index 6c5a5a2937..d29b1a2f2b 100644 --- a/test/Mvc.Analyzers.Test/CodeAnalysisExtensionsTest.cs +++ b/test/Mvc.Analyzers.Test/CodeAnalysisExtensionsTest.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; diff --git a/test/Mvc.Analyzers.Test/Infrastructure/MvcDiagnosticAnalyzerRunner.cs b/test/Mvc.Analyzers.Test/Infrastructure/MvcDiagnosticAnalyzerRunner.cs index 52a18845f0..f29cff84d1 100644 --- a/test/Mvc.Analyzers.Test/Infrastructure/MvcDiagnosticAnalyzerRunner.cs +++ b/test/Mvc.Analyzers.Test/Infrastructure/MvcDiagnosticAnalyzerRunner.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Analyzer.Testing; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; -namespace Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure +namespace Microsoft.AspNetCore.Mvc { public class MvcDiagnosticAnalyzerRunner : DiagnosticAnalyzerRunner { diff --git a/test/Mvc.Analyzers.Test/Infrastructure/MvcTestSource.cs b/test/Mvc.Analyzers.Test/Infrastructure/MvcTestSource.cs index 19c19140d1..e0e2df6493 100644 --- a/test/Mvc.Analyzers.Test/Infrastructure/MvcTestSource.cs +++ b/test/Mvc.Analyzers.Test/Infrastructure/MvcTestSource.cs @@ -5,7 +5,7 @@ using System.IO; using Microsoft.AspNetCore.Analyzer.Testing; using Microsoft.AspNetCore.Testing; -namespace Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure +namespace Microsoft.AspNetCore.Mvc { public static class MvcTestSource { diff --git a/test/Mvc.Analyzers.Test/AddResponseTypeAttributeCodeFixProviderIntegrationTest.cs b/test/Mvc.Api.Analyzers.Test/AddResponseTypeAttributeCodeFixProviderIntegrationTest.cs similarity index 95% rename from test/Mvc.Analyzers.Test/AddResponseTypeAttributeCodeFixProviderIntegrationTest.cs rename to test/Mvc.Api.Analyzers.Test/AddResponseTypeAttributeCodeFixProviderIntegrationTest.cs index cfcf6f63f7..beea4d68a7 100644 --- a/test/Mvc.Analyzers.Test/AddResponseTypeAttributeCodeFixProviderIntegrationTest.cs +++ b/test/Mvc.Api.Analyzers.Test/AddResponseTypeAttributeCodeFixProviderIntegrationTest.cs @@ -1,15 +1,13 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class AddResponseTypeAttributeCodeFixProviderIntegrationTest { diff --git a/test/Mvc.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest.cs b/test/Mvc.Api.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest.cs similarity index 93% rename from test/Mvc.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest.cs rename to test/Mvc.Api.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest.cs index d2feb871ff..9b3e546014 100644 --- a/test/Mvc.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest.cs +++ b/test/Mvc.Api.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest.cs @@ -4,10 +4,9 @@ using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { @@ -65,7 +64,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers private async Task RunTest([CallerMemberName] string testMethod = "") { // Arrange - var descriptor = DiagnosticDescriptors.MVC1007_ApiActionsDoNotRequireExplicitModelValidationCheck; + var descriptor = ApiDiagnosticDescriptors.API1003_ApiActionsDoNotRequireExplicitModelValidationCheck; var testSource = MvcTestSource.Read(GetType().Name, testMethod); var expectedLocation = testSource.DefaultMarkerLocation; diff --git a/test/Mvc.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest.cs b/test/Mvc.Api.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest.cs similarity index 95% rename from test/Mvc.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest.cs rename to test/Mvc.Api.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest.cs index d470e22112..918a04940a 100644 --- a/test/Mvc.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest.cs +++ b/test/Mvc.Api.Analyzers.Test/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest.cs @@ -4,11 +4,10 @@ using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest { diff --git a/test/Mvc.Analyzers.Test/ApiControllerFactsTest.cs b/test/Mvc.Api.Analyzers.Test/ApiControllerFactsTest.cs similarity index 97% rename from test/Mvc.Analyzers.Test/ApiControllerFactsTest.cs rename to test/Mvc.Api.Analyzers.Test/ApiControllerFactsTest.cs index a264d33878..f096f51455 100644 --- a/test/Mvc.Analyzers.Test/ApiControllerFactsTest.cs +++ b/test/Mvc.Api.Analyzers.Test/ApiControllerFactsTest.cs @@ -4,11 +4,10 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class ApiControllerFactsTest { diff --git a/test/Mvc.Analyzers.Test/ApiConventionAnalyzerIntegrationTest.cs b/test/Mvc.Api.Analyzers.Test/ApiConventionAnalyzerIntegrationTest.cs similarity index 79% rename from test/Mvc.Analyzers.Test/ApiConventionAnalyzerIntegrationTest.cs rename to test/Mvc.Api.Analyzers.Test/ApiConventionAnalyzerIntegrationTest.cs index 41ada495e3..13942b0046 100644 --- a/test/Mvc.Analyzers.Test/ApiConventionAnalyzerIntegrationTest.cs +++ b/test/Mvc.Api.Analyzers.Test/ApiConventionAnalyzerIntegrationTest.cs @@ -5,11 +5,10 @@ using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class ApiConventionAnalyzerIntegrationTest { @@ -41,55 +40,55 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers [Fact] public Task DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode() - => RunTest(DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, 404); + => RunTest(ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, 404); [Fact] public Task DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode() - => RunTest(DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, 404); + => RunTest(ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, 404); [Fact] public Task DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode() - => RunTest(DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, 200); + => RunTest(ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, 200); [Fact] public Task DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes() - => RunTest(DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, 404); + => RunTest(ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, 404); [Fact] public Task DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes() - => RunTest(DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, 422); + => RunTest(ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, 422); [Fact] public Task DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode() - => RunTest(DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, 400); + => RunTest(ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, 400); [Fact] public Task DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode() - => RunTest(DiagnosticDescriptors.MVC1004_ActionReturnsUndocumentedStatusCode, 202); + => RunTest(ApiDiagnosticDescriptors.API1000_ActionReturnsUndocumentedStatusCode, 202); [Fact] public Task DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation() - => RunTest(DiagnosticDescriptors.MVC1005_ActionReturnsUndocumentedSuccessResult); + => RunTest(ApiDiagnosticDescriptors.API1001_ActionReturnsUndocumentedSuccessResult); [Fact] public Task DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation() - => RunTest(DiagnosticDescriptors.MVC1005_ActionReturnsUndocumentedSuccessResult); + => RunTest(ApiDiagnosticDescriptors.API1001_ActionReturnsUndocumentedSuccessResult); [Fact] public Task DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType() - => RunTest(DiagnosticDescriptors.MVC1005_ActionReturnsUndocumentedSuccessResult); + => RunTest(ApiDiagnosticDescriptors.API1001_ActionReturnsUndocumentedSuccessResult); [Fact] public Task DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode() - => RunTest(DiagnosticDescriptors.MVC1006_ActionDoesNotReturnDocumentedStatusCode, 400); + => RunTest(ApiDiagnosticDescriptors.API1002_ActionDoesNotReturnDocumentedStatusCode, 400); [Fact] public Task DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode() - => RunTest(DiagnosticDescriptors.MVC1006_ActionDoesNotReturnDocumentedStatusCode, 404); + => RunTest(ApiDiagnosticDescriptors.API1002_ActionDoesNotReturnDocumentedStatusCode, 404); [Fact] public Task DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode() - => RunTest(DiagnosticDescriptors.MVC1006_ActionDoesNotReturnDocumentedStatusCode, 200); + => RunTest(ApiDiagnosticDescriptors.API1002_ActionDoesNotReturnDocumentedStatusCode, 200); private async Task RunNoDiagnosticsAreReturned([CallerMemberName] string testMethod = "") { @@ -143,7 +142,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers // 10006 is disabled by default. Explicitly enable it so we can correctly validate no diagnostics // are returned scenarios. var specificDiagnosticOptions = compilationOptions.SpecificDiagnosticOptions.Add( - DiagnosticDescriptors.MVC1006_ActionDoesNotReturnDocumentedStatusCode.Id, + ApiDiagnosticDescriptors.API1002_ActionDoesNotReturnDocumentedStatusCode.Id, ReportDiagnostic.Info); return compilationOptions.WithSpecificDiagnosticOptions(specificDiagnosticOptions); diff --git a/test/Mvc.Api.Analyzers.Test/Mvc.Api.Analyzers.Test.csproj b/test/Mvc.Api.Analyzers.Test/Mvc.Api.Analyzers.Test.csproj new file mode 100644 index 0000000000..76dffea5a6 --- /dev/null +++ b/test/Mvc.Api.Analyzers.Test/Mvc.Api.Analyzers.Test.csproj @@ -0,0 +1,22 @@ + + + + $(StandardTestTfms) + Microsoft.AspNetCore.Mvc.Api.Analyzers + + + + + + + + + + + + + + + + + diff --git a/test/Mvc.Analyzers.Test/MvcFactsTest.cs b/test/Mvc.Api.Analyzers.Test/MvcFactsTest.cs similarity index 99% rename from test/Mvc.Analyzers.Test/MvcFactsTest.cs rename to test/Mvc.Api.Analyzers.Test/MvcFactsTest.cs index 6cb3a518a7..e6009e7125 100644 --- a/test/Mvc.Analyzers.Test/MvcFactsTest.cs +++ b/test/Mvc.Api.Analyzers.Test/MvcFactsTest.cs @@ -5,11 +5,10 @@ using System; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class MvcFactsTest { diff --git a/test/Mvc.Analyzers.Test/SymbolApiConventionMatcherTest.cs b/test/Mvc.Api.Analyzers.Test/SymbolApiConventionMatcherTest.cs similarity index 99% rename from test/Mvc.Analyzers.Test/SymbolApiConventionMatcherTest.cs rename to test/Mvc.Api.Analyzers.Test/SymbolApiConventionMatcherTest.cs index 34441fc218..041d148624 100644 --- a/test/Mvc.Analyzers.Test/SymbolApiConventionMatcherTest.cs +++ b/test/Mvc.Api.Analyzers.Test/SymbolApiConventionMatcherTest.cs @@ -5,12 +5,11 @@ using System; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Xunit; -using static Microsoft.AspNetCore.Mvc.Analyzers.SymbolApiConventionMatcher; +using static Microsoft.AspNetCore.Mvc.Api.Analyzers.SymbolApiConventionMatcher; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class SymbolApiConventionMatcherTest { diff --git a/test/Mvc.Analyzers.Test/SymbolApiResponseMetadataProviderTest.cs b/test/Mvc.Api.Analyzers.Test/SymbolApiResponseMetadataProviderTest.cs similarity index 99% rename from test/Mvc.Analyzers.Test/SymbolApiResponseMetadataProviderTest.cs rename to test/Mvc.Api.Analyzers.Test/SymbolApiResponseMetadataProviderTest.cs index e31f22e8ce..e6ccc12470 100644 --- a/test/Mvc.Analyzers.Test/SymbolApiResponseMetadataProviderTest.cs +++ b/test/Mvc.Api.Analyzers.Test/SymbolApiResponseMetadataProviderTest.cs @@ -6,12 +6,11 @@ using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Analyzer.Testing; -using Microsoft.AspNetCore.Mvc.Analyzers.Infrastructure; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; using Xunit; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class SymbolApiResponseMetadataProviderTest { @@ -395,7 +394,7 @@ namespace Microsoft.AspNetCore.Mvc.Analyzers var source = @" using Microsoft.AspNetCore.Mvc; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class InspectReturnExpression_ReturnsNull_IfReturnExpressionCannotBeFound : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Input.cs similarity index 100% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Input.cs diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Output.cs similarity index 100% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsFullyQualifiedProducesResponseType.Output.cs diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Input.cs similarity index 88% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Input.cs index 708fd10db9..a2992eb108 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Input.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Input.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers._INPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._INPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Output.cs similarity index 90% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Output.cs index b0f2b96dc6..136b633726 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Output.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsMissingStatusCodes.Output.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers._OUTPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._OUTPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Input.cs similarity index 84% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Input.cs index 39ae582dfd..7c3e027608 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Input.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Input.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers._INPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._INPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Output.cs similarity index 87% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Output.cs index 690618c254..09e944a4b8 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Output.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsStatusCodes.Output.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers._OUTPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._OUTPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Input.cs similarity index 90% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Input.cs index 63dc63e6c2..ff32f9b56d 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Input.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Input.cs @@ -2,7 +2,7 @@ [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers._INPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._INPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Output.cs similarity index 92% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Output.cs index 2bc2dae2af..d51b75a841 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Output.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixAddsSuccessStatusCode.Output.cs @@ -2,7 +2,7 @@ [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers._OUTPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._OUTPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Input.cs similarity index 88% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Input.cs index e907935bf4..55a1e429b7 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Input.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Input.cs @@ -2,7 +2,7 @@ [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers._INPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._INPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Output.cs similarity index 90% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Output.cs index 14c1a06e29..94e564948d 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Output.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionAddsMissingStatusCodes.Output.cs @@ -2,7 +2,7 @@ [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers._OUTPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._OUTPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Input.cs similarity index 88% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Input.cs index 960c9f8450..96e622e16b 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Input.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Input.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers._INPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._INPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Output.cs similarity index 88% rename from test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Output.cs index e5c384bf06..24be3e391c 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Output.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/AddResponseTypeAttributeCodeFixProviderIntegrationTest/CodeFixWithConventionMethodAddsMissingStatusCodes.Output.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers._OUTPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers._OUTPUT_ { [ApiController] [Route("[controller]/[action]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecks.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecks.cs similarity index 76% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecks.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecks.cs index 1c60c0d9ee..2966097a0f 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecks.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecks.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksUsingEquality.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksUsingEquality.cs similarity index 77% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksUsingEquality.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksUsingEquality.cs index b4056af443..432789e86e 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksUsingEquality.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksUsingEquality.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksWithoutBracing.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksWithoutBracing.cs similarity index 74% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksWithoutBracing.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksWithoutBracing.cs index 26b8712711..e62ee68014 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksWithoutBracing.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/DiagnosticsAreReturned_ForApiActionsWithModelStateChecksWithoutBracing.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsCheckingAdditionalConditions.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsCheckingAdditionalConditions.cs similarity index 75% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsCheckingAdditionalConditions.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsCheckingAdditionalConditions.cs index 056ba8a266..8ed22e69b9 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsCheckingAdditionalConditions.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsCheckingAdditionalConditions.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturning400FromNonModelStateIsValidBlocks.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturning400FromNonModelStateIsValidBlocks.cs similarity index 72% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturning400FromNonModelStateIsValidBlocks.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturning400FromNonModelStateIsValidBlocks.cs index 32cf061473..698fa72476 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturning400FromNonModelStateIsValidBlocks.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturning400FromNonModelStateIsValidBlocks.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturningNot400FromNonModelStateIsValidBlock.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturningNot400FromNonModelStateIsValidBlock.cs similarity index 73% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturningNot400FromNonModelStateIsValidBlock.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturningNot400FromNonModelStateIsValidBlock.cs index e08e3e9489..86659db6f9 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturningNot400FromNonModelStateIsValidBlock.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsReturningNot400FromNonModelStateIsValidBlock.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsWithoutModelStateChecks.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsWithoutModelStateChecks.cs similarity index 69% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsWithoutModelStateChecks.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsWithoutModelStateChecks.cs index b60f20b7a7..e24c094562 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsWithoutModelStateChecks.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiActionsWithoutModelStateChecks.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { [ApiController] public class NoDiagnosticsAreReturned_ForApiActionsWithoutModelStateChecks : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs similarity index 67% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs index abc6b48359..c9b044457f 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { public class NoDiagnosticsAreReturned_ForNonApiController : ControllerBase { diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs similarity index 68% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs index 4537050f31..30b7c5cceb 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc.RazorPages; -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzerIntegrationTest { public class Home : PageModel { diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Input.cs similarity index 72% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Input.cs index b3c31d8536..2608c14bc5 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Input.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Input.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._INPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._INPUT_ { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Output.cs similarity index 67% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Output.cs index 1b5bd73c47..9d10cebb31 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Output.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesIfBlockWithoutBraces.Output.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._OUTPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._OUTPUT_ { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Input.cs similarity index 76% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Input.cs index 6d1d9db2f5..9a12968723 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Input.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Input.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._INPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._INPUT_ { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Output.cs similarity index 70% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Output.cs index 8d61173949..8ba42c4bfd 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Output.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithEqualityCheck.Output.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._OUTPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._OUTPUT_ { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Input.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Input.cs similarity index 75% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Input.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Input.cs index 0a1071c29c..f737c35206 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Input.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Input.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._INPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._INPUT_ { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Output.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Output.cs similarity index 70% rename from test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Output.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Output.cs index 1d82b016e9..a61edaf518 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Output.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest/CodeFixRemovesModelStateIsInvalidBlockWithIfNotCheck.Output.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._OUTPUT_ +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers.TestFiles.ApiActionsDoNotRequireExplicitModelValidationCheckCodeFixProviderTest._OUTPUT_ { [ApiController] [Route("/api/[controller]")] diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiControllerFactsTest/TestFile.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiControllerFactsTest/TestFile.cs similarity index 92% rename from test/Mvc.Analyzers.Test/TestFiles/ApiControllerFactsTest/TestFile.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiControllerFactsTest/TestFile.cs index 397c9b86b1..7eb8c8584c 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiControllerFactsTest/TestFile.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiControllerFactsTest/TestFile.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc.RazorPages; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class ApiConventionAnalyzerTest_IndexModel : PageModel { diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes.cs similarity index 90% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes.cs index 2e0fc59064..42ce3bd069 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc; [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutAnyAttributes : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes.cs similarity index 92% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes.cs index 7d6169af7e..1b341aed17 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_ForActionResultOfTReturningMethodWithoutSomeAttributes : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForControllerWithCustomConvention.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForControllerWithCustomConvention.cs similarity index 92% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForControllerWithCustomConvention.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForControllerWithCustomConvention.cs index 07ea47c1a4..884d613e04 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForControllerWithCustomConvention.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_ForControllerWithCustomConvention.cs @@ -1,11 +1,11 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Analyzers; +using Microsoft.AspNetCore.Mvc.Api.Analyzers; [assembly: ApiConventionType(typeof(DiagnosticsAreReturned_ForControllerWithCustomConvention))] -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_ForControllerWithCustomConventionController : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs similarity index 91% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs index ce686e8dcf..3e263cffd9 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfAsyncMethodReturningValueTaskWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs similarity index 91% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs index eb8f5cd36a..d61842d16f 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfAsyncMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode.cs similarity index 90% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode.cs index 1b7dcc3454..f09255b7d0 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode.cs @@ -2,7 +2,7 @@ [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithApiConventionMethod_ReturnsUndocumentedStatusCode : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs similarity index 94% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs index b27ed2dc61..4a93438cfd 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation.cs similarity index 92% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation.cs index 3de2b09935..1c4a8f59cf 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithAttributeReturnsValue_WithoutDocumentation : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType.cs similarity index 94% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType.cs index ef4bf9ff03..82d6805a68 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithAttribute_ReturnsDerivedType : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode.cs similarity index 90% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode.cs index fb880c322b..62929c1f2e 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode.cs @@ -2,7 +2,7 @@ [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithConvention_DoesNotReturnDocumentedStatusCode : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode.cs similarity index 89% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode.cs index fa5b642f2e..a49f31108a 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Analyzers; +using Microsoft.AspNetCore.Mvc.Api.Analyzers; [assembly: ApiConventionType(typeof(DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCodeConvention))] -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithConvention_ReturnsUndocumentedStatusCode : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode.cs similarity index 90% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode.cs index bdbc7bf659..a45428d467 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode.cs @@ -1,6 +1,6 @@ using System; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotDocumentSuccessStatusCode : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode.cs similarity index 91% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode.cs index 8893357089..59b1c99c88 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_DoesNotReturnDocumentedStatusCode : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs similarity index 88% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs index 2541e2f98e..ad4c183a51 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class DiagnosticsAreReturned_IfMethodWithProducesResponseTypeAttribute_ReturnsUndocumentedStatusCode : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_IfStatusCodesCannotBeInferred.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_IfStatusCodesCannotBeInferred.cs similarity index 85% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_IfStatusCodesCannotBeInferred.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_IfStatusCodesCannotBeInferred.cs index ad6e5956b4..e2866071d4 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_IfStatusCodesCannotBeInferred.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_IfStatusCodesCannotBeInferred.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class NoDiagnosticsAreReturned_ForApiController_IfStatusCodesCannotBeInferred : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_WithAllDocumentedStatusCodes.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_WithAllDocumentedStatusCodes.cs similarity index 93% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_WithAllDocumentedStatusCodes.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_WithAllDocumentedStatusCodes.cs index 06bb57f1ee..c7aaac3596 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_WithAllDocumentedStatusCodes.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForApiController_WithAllDocumentedStatusCodes.cs @@ -2,7 +2,7 @@ [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class NoDiagnosticsAreReturned_ForApiController_WithAllDocumentedStatusCodes : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs similarity index 87% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs index 0e55a8c574..1d790dab91 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForNonApiController.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class NoDiagnosticsAreReturned_ForNonApiController : Controller { diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs similarity index 86% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs index 9299b5b5b8..fa410dc115 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForRazorPageModels.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc.RazorPages; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class Home : PageModel { diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLambdas.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLambdas.cs similarity index 94% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLambdas.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLambdas.cs index bd62df3b3b..0770de818d 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLambdas.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLambdas.cs @@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Mvc; [assembly: ApiConventionType(typeof(DefaultApiConventions))] -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class NoDiagnosticsAreReturned_ForReturnStatementsInLambdas : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLocalFunctions.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLocalFunctions.cs similarity index 93% rename from test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLocalFunctions.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLocalFunctions.cs index 332de79235..329bde822d 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLocalFunctions.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/ApiConventionAnalyzerIntegrationTest/NoDiagnosticsAreReturned_ForReturnStatementsInLocalFunctions.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [ApiController] public class NoDiagnosticsAreReturned_ForReturnStatementsInLocalFunctions : ControllerBase diff --git a/test/Mvc.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerActionTests.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerActionTests.cs similarity index 97% rename from test/Mvc.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerActionTests.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerActionTests.cs index 607715bcb7..085ba88d9a 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerActionTests.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerActionTests.cs @@ -1,6 +1,6 @@ using System; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public abstract class TestIsControllerActionBase : ControllerBase { diff --git a/test/Mvc.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerTests.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerTests.cs similarity index 95% rename from test/Mvc.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerTests.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerTests.cs index 1837ac712b..1c765c6fd3 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerTests.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/MvcFactsTest/IsControllerTests.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public interface ITestController { } diff --git a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiConventionMatcherTest/SymbolApiConventionMatcherTestFile.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiConventionMatcherTest/SymbolApiConventionMatcherTestFile.cs similarity index 97% rename from test/Mvc.Analyzers.Test/TestFiles/SymbolApiConventionMatcherTest/SymbolApiConventionMatcherTestFile.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiConventionMatcherTest/SymbolApiConventionMatcherTestFile.cs index 9e549f8016..3d27daef10 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiConventionMatcherTest/SymbolApiConventionMatcherTestFile.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiConventionMatcherTest/SymbolApiConventionMatcherTestFile.cs @@ -1,7 +1,7 @@ using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Mvc.ApiExplorer; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class Base { } diff --git a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetDefaultStatusCodeTest.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetDefaultStatusCodeTest.cs similarity index 87% rename from test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetDefaultStatusCodeTest.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetDefaultStatusCodeTest.cs index 6d9412a840..8fb75a9e49 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetDefaultStatusCodeTest.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetDefaultStatusCodeTest.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Infrastructure; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { [DefaultStatusCode(StatusCodes.Status412PreconditionFailed)] public class TestActionResultUsingStatusCodesConstants { } diff --git a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetResponseMetadataTests.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetResponseMetadataTests.cs similarity index 98% rename from test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetResponseMetadataTests.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetResponseMetadataTests.cs index a296f9b93f..9040a07256 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetResponseMetadataTests.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/GetResponseMetadataTests.cs @@ -5,7 +5,7 @@ using System; using Microsoft.AspNetCore.Mvc.ApiExplorer; using Microsoft.AspNetCore.Mvc.Formatters; -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class GetResponseMetadata_ControllerWithoutConvention : ControllerBase { diff --git a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsDefaultResponseMetadata_IfReturnedTypeIsNotActionResult.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsDefaultResponseMetadata_IfReturnedTypeIsNotActionResult.cs similarity index 88% rename from test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsDefaultResponseMetadata_IfReturnedTypeIsNotActionResult.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsDefaultResponseMetadata_IfReturnedTypeIsNotActionResult.cs index ce2dbbb39b..02a1ffb40a 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsDefaultResponseMetadata_IfReturnedTypeIsNotActionResult.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsDefaultResponseMetadata_IfReturnedTypeIsNotActionResult.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class InspectReturnExpression_ReturnsDefaultResponseMetadata_IfReturnedTypeIsNotActionResult : ControllerBase { diff --git a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsStatusCodeFromDefaultStatusCodeAttributeOnActionResult.cs b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsStatusCodeFromDefaultStatusCodeAttributeOnActionResult.cs similarity index 81% rename from test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsStatusCodeFromDefaultStatusCodeAttributeOnActionResult.cs rename to test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsStatusCodeFromDefaultStatusCodeAttributeOnActionResult.cs index 4d5d0d9849..94d66474f5 100644 --- a/test/Mvc.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsStatusCodeFromDefaultStatusCodeAttributeOnActionResult.cs +++ b/test/Mvc.Api.Analyzers.Test/TestFiles/SymbolApiResponseMetadataProviderTest/InspectReturnExpression_ReturnsStatusCodeFromDefaultStatusCodeAttributeOnActionResult.cs @@ -1,4 +1,4 @@ -namespace Microsoft.AspNetCore.Mvc.Analyzers +namespace Microsoft.AspNetCore.Mvc.Api.Analyzers { public class InspectReturnExpression_ReturnsStatusCodeFromDefaultStatusCodeAttributeOnActionResult : ControllerBase {