Make Microsoft.AspNetCore.Mvc.TestCommon a regular project

* This allows specifying all it's dependencies rather than for consuming projects to do this
* Remove unused APIs
* Fix weird downgrade warnings that show up due to P2P references
This commit is contained in:
Pranav K 2016-11-21 15:50:38 -08:00
parent 4660c410b3
commit 5b2a4aecb6
23 changed files with 111 additions and 149 deletions

View File

@ -5,16 +5,10 @@
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.Logging.Testing": "1.2.0-*",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.DotNet.InternalAbstractions": "1.0.0"
},
"testRunner": "xunit",
"frameworks": {

View File

@ -8,24 +8,19 @@
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Http": "1.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Mvc.TestDiagnosticListener.Sources": {
"target": "project",
"type": "build"
},
"Microsoft.AspNetCore.ResponseCaching": "1.0.0-*",
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.DependencyInjection": "1.2.0-*",
"Microsoft.Extensions.DiagnosticAdapter": "1.2.0-*",
"Microsoft.Extensions.Logging": "1.2.0-*",
"Microsoft.Extensions.Logging.Testing": "1.2.0-*",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.Extensions.Logging.Testing": "1.2.0-*"
},
"testRunner": "xunit",
"frameworks": {

View File

@ -5,18 +5,13 @@
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Http": "1.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Cors": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.DependencyInjection": "1.2.0-*",
"Microsoft.Extensions.Logging.Testing": "1.2.0-*",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.Extensions.Logging.Testing": "1.2.0-*"
},
"testRunner": "xunit",
"frameworks": {

View File

@ -5,22 +5,16 @@
},
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.DependencyInjection": "1.2.0-*",
"Microsoft.Extensions.HashCodeCombiner.Sources": {
"version": "1.2.0-*",
"type": "build"
},
"Microsoft.Extensions.Logging.Testing": "1.2.0-*",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.Extensions.Logging.Testing": "1.2.0-*"
},
"testRunner": "xunit",
"frameworks": {

View File

@ -5,18 +5,13 @@
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Http": "1.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.DependencyInjection": "1.2.0-*",
"Microsoft.Extensions.Logging.Testing": "1.2.0-*",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.Extensions.Logging.Testing": "1.2.0-*"
},
"testRunner": "xunit",
"frameworks": {

View File

@ -6,16 +6,10 @@
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Http": "1.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.DotNet.InternalAbstractions": "1.0.0"
},
"testRunner": "xunit",
"frameworks": {

View File

@ -10,44 +10,80 @@
"warningsAsErrors": true
},
"dependencies": {
"SecurityWebSite": "1.0.0",
"ApiExplorerWebSite": "1.0.0",
"ApplicationModelWebSite": "1.0.0",
"BasicWebSite": "1.0.0",
"ControllersFromServicesWebSite": "1.0.0",
"CorsWebSite": "1.0.0",
"ApiExplorerWebSite": {
"target": "project"
},
"ApplicationModelWebSite": {
"target": "project"
},
"BasicWebSite": {
"target": "project"
},
"ControllersFromServicesWebSite": {
"target": "project"
},
"CorsWebSite": {
"target": "project"
},
"dotnet-test-xunit": "2.2.0-*",
"ErrorPageMiddlewareWebSite": "1.0.0",
"FilesWebSite": "1.0.0",
"FiltersWebSite": "1.0.0",
"FormatterWebSite": "1.0.0",
"HtmlGenerationWebSite": "1.0.0",
"ErrorPageMiddlewareWebSite": {
"target": "project"
},
"FilesWebSite": {
"target": "project"
},
"FiltersWebSite": {
"target": "project"
},
"FormatterWebSite": {
"target": "project"
},
"HtmlGenerationWebSite": {
"target": "project"
},
"Microsoft.AspNetCore.ChunkingCookieManager.Sources": {
"version": "1.2.0-*",
"type": "build"
},
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
},
"Microsoft.AspNetCore.Mvc.TestConfiguration": "1.0.0",
"Microsoft.AspNetCore.TestHost": "1.2.0-*",
"Microsoft.AspNetCore.WebUtilities": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.2.0-*",
"Microsoft.Extensions.Logging.Testing": "1.2.0-*",
"MvcSandbox": "1.0.0",
"RazorPageExecutionInstrumentationWebSite": "1.0.0",
"RazorWebSite": "1.0.0",
"RoutingWebSite": "1.0.0",
"SimpleWebSite": "1.0.0",
"TagHelpersWebSite": "1.0.0",
"VersioningWebSite": "1.0.0",
"WebApiCompatShimWebSite": "1.0.0",
"XmlFormattersWebSite": "1.0.0",
"xunit": "2.2.0-*"
"MvcSandbox": {
"target": "project"
},
"RazorPageExecutionInstrumentationWebSite": {
"target": "project"
},
"RazorWebSite": {
"target": "project"
},
"RoutingWebSite": {
"target": "project"
},
"SecurityWebSite": {
"target": "project"
},
"SimpleWebSite": {
"target": "project"
},
"TagHelpersWebSite": {
"target": "project"
},
"VersioningWebSite": {
"target": "project"
},
"WebApiCompatShimWebSite": {
"target": "project"
},
"XmlFormattersWebSite": {
"target": "project"
}
},
"testRunner": "xunit",
"frameworks": {

View File

@ -6,16 +6,11 @@
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Http": "1.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.Logging": "1.2.0-*",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.Extensions.Logging": "1.2.0-*"
},
"testRunner": "xunit",
"frameworks": {

View File

@ -5,11 +5,8 @@
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Localization": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",

View File

@ -1,6 +1,7 @@
// 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.IO;
using Microsoft.AspNetCore.Razor.Chunks;
using Microsoft.AspNetCore.Razor.Runtime.TagHelpers;
using Xunit;
@ -37,7 +38,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Directives
// Act
var chunkTreeResults = utility.GetInheritedChunkTreeResults(
PlatformNormalizer.NormalizePath(@"Views\home\Index.cshtml"));
Path.Combine("Views", "home", "Index.cshtml"));
// Assert
Assert.Collection(chunkTreeResults,
@ -127,7 +128,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Directives
var utility = new ChunkInheritanceUtility(host, cache, defaultChunks);
// Act
var chunkTrees = utility.GetInheritedChunkTreeResults(PlatformNormalizer.NormalizePath(@"Views\home\Index.cshtml"));
var chunkTrees = utility.GetInheritedChunkTreeResults(Path.Combine("Views", "home", "Index.cshtml"));
// Assert
Assert.Empty(chunkTrees);

View File

@ -1,16 +1,10 @@
{
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Mvc.Core": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.DataAnnotations": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Razor": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Razor.Host": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.2.0-*",
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Moq": "4.6.36-*",

View File

@ -3,14 +3,6 @@
"preserveCompilationContext": true,
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk",
"compile": {
"include": [
"../Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFileProvider.cs",
"../Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFileInfo.cs",
"../Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFileTrigger.cs",
"../Microsoft.AspNetCore.Mvc.ViewFeatures.Test/Internal/TestViewBufferScope.cs"
]
},
"define": [
"SOME_TEST_DEFINE"
]
@ -19,28 +11,21 @@
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Http": "1.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.DataAnnotations": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Razor": "1.2.0-*",
"Microsoft.AspNetCore.Razor.TagHelpers.Testing.Sources": {
"version": "1.2.0-*",
"type": "build"
},
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Mvc.TestDiagnosticListener.Sources": {
"target": "project",
"type": "build"
},
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.DependencyInjection": "1.2.0-*",
"Microsoft.Extensions.DiagnosticAdapter": "1.2.0-*",
"Microsoft.Extensions.Logging.Testing": "1.2.0-*",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.Extensions.Logging.Testing": "1.2.0-*"
},
"testRunner": "xunit",
"frameworks": {

View File

@ -4,7 +4,7 @@
},
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Testing": "1.1.0-*",
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"

View File

@ -6,12 +6,9 @@
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Http": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.DataAnnotations": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Razor.TagHelpers.Testing.Sources": {
"version": "1.2.0-*",

View File

@ -1,7 +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.
#if !FUNCTIONAL_TESTS
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
@ -238,4 +237,3 @@ namespace Microsoft.AspNetCore.Mvc.Filters
}
}
}
#endif

View File

@ -1,12 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// 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.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Razor;
using Microsoft.AspNetCore.Testing;
namespace Microsoft.AspNetCore.Mvc
{
@ -44,17 +43,6 @@ namespace Microsoft.AspNetCore.Mvc
return input;
}
// Each new line character is returned as "_".
public static string GetNewLinesAsUnderscores(int numberOfNewLines)
{
return new string('_', numberOfNewLines * Environment.NewLine.Length);
}
public static string NormalizePath(string path)
{
return path.Replace('\\', Path.DirectorySeparatorChar);
}
// Assuming windows based source location is passed in,
// it gets normalized to other platforms.
public static SourceLocation NormalizedSourceLocation(int absoluteIndex, int lineIndex, int characterIndex)
@ -63,5 +51,5 @@ namespace Microsoft.AspNetCore.Mvc
var differenceInLength = windowsNewLineLength - Environment.NewLine.Length;
return new SourceLocation(absoluteIndex - (differenceInLength * lineIndex), lineIndex, characterIndex);
}
}
}
}

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc.DataAnnotations.Internal;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
internal class TestClientModelValidatorProvider : CompositeClientModelValidatorProvider
public class TestClientModelValidatorProvider : CompositeClientModelValidatorProvider
{
// Creates a provider with all the defaults - includes data annotations
public static IClientModelValidatorProvider CreateDefaultProvider()

View File

@ -13,7 +13,7 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
internal class TestModelMetadataProvider : DefaultModelMetadataProvider
public class TestModelMetadataProvider : DefaultModelMetadataProvider
{
// Creates a provider with all the defaults - includes data annotations
public static IModelMetadataProvider CreateDefaultProvider(IStringLocalizerFactory stringLocalizerFactory = null)

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc.Internal;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
internal class TestModelValidatorProvider : CompositeModelValidatorProvider
public class TestModelValidatorProvider : CompositeModelValidatorProvider
{
// Creates a provider with all the defaults - includes data annotations
public static CompositeModelValidatorProvider CreateDefaultProvider()

View File

@ -24,12 +24,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
return attr.FormatErrorMessage(field);
}
public static string GetMaxLengthErrorMessage(int maximumLength, string field)
{
var attr = new MaxLengthAttribute(maximumLength);
return attr.FormatErrorMessage(field);
}
public static string GetRegExErrorMessage(string pattern, string field)
{
var attr = new RegularExpressionAttribute(pattern);

View File

@ -1,11 +1,27 @@
{
"shared": "**/*.cs",
"buildOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk"
},
"frameworks": {
"net451": {},
"netstandard1.3": {
"netstandard1.6": {
"dependencies": {
"NETStandard.Library": "1.6.1-*"
"System.ComponentModel.Annotations": "4.3.0"
}
}
},
"dependencies": {
"Microsoft.AspNetCore.Html.Abstractions": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.2.0-*",
"Microsoft.AspNetCore.Razor": "1.2.0-*",
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.Extensions.FileProviders.Abstractions": "1.2.0-*",
"Microsoft.Extensions.Options": "1.2.0-*",
"Microsoft.Extensions.WebEncoders": "1.2.0-*",
"Moq": "4.6.36-*",
"NETStandard.Library": "1.6.1-*",
"xunit": "2.2.0-*"
}
}

View File

@ -7,23 +7,17 @@
"dotnet-test-xunit": "2.2.0-*",
"Microsoft.AspNetCore.Http": "1.2.0-*",
"Microsoft.AspNetCore.Mvc": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.2.0-*",
"Microsoft.AspNetCore.Mvc.TestCommon": {
"target": "project",
"type": "build"
"target": "project"
},
"Microsoft.AspNetCore.Mvc.TestDiagnosticListener.Sources": {
"target": "project",
"type": "build"
},
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.2.0-*",
"Microsoft.AspNetCore.Testing": "1.2.0-*",
"Microsoft.DotNet.InternalAbstractions": "1.0.0",
"Microsoft.Extensions.DependencyInjection": "1.2.0-*",
"Microsoft.Extensions.DiagnosticAdapter": "1.2.0-*",
"Microsoft.Extensions.Logging.Testing": "1.2.0-*",
"Moq": "4.6.36-*",
"xunit": "2.2.0-*"
"Microsoft.Extensions.Logging.Testing": "1.2.0-*"
},
"testRunner": "xunit",
"frameworks": {