From e4fb1d44cee27564cde27a84baca34434b58729e Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Fri, 11 Oct 2019 14:26:03 -0700 Subject: [PATCH 1/2] Revert "Remove 1.x tests (dotnet/aspnetcore-tooling#1169)" This reverts commit dotnet/aspnetcore-tooling@bd71bcf87b1c9a9401454c2df9ebed1f8157f91e. \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/61b1896d00511a37d97cfadff9237099e5628c9c --- .../BuildIntegrationTest11.cs | 58 ++++++++++ .../RestoreTestProjects.csproj | 2 + .../test/testassets/SimpleMvc11/Program.cs | 13 +++ .../testassets/SimpleMvc11/SimpleMvc11.csproj | 23 ++++ .../SimpleMvc11/Views/Home/Index.cshtml | 108 ++++++++++++++++++ .../SimpleMvc11/Views/Shared/_Layout.cshtml | 71 ++++++++++++ .../SimpleMvc11/Views/_ViewImports.cshtml | 3 + .../SimpleMvc11/Views/_ViewStart.cshtml | 3 + .../testassets/SimpleMvc11NetFx/Program.cs | 13 +++ .../SimpleMvc11NetFx/SimpleMvc11NetFx.csproj | 19 +++ .../SimpleMvc11NetFx/Views/Home/Index.cshtml | 108 ++++++++++++++++++ .../Views/Shared/_Layout.cshtml | 71 ++++++++++++ .../Views/_ViewImports.cshtml | 2 + .../SimpleMvc11NetFx/Views/_ViewStart.cshtml | 3 + 14 files changed, 497 insertions(+) create mode 100644 src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs create mode 100644 src/Razor/test/testassets/SimpleMvc11/Program.cs create mode 100644 src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj create mode 100644 src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml create mode 100644 src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml create mode 100644 src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml create mode 100644 src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml create mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs create mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj create mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml create mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml create mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml create mode 100644 src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs new file mode 100644 index 0000000000..dc7d470a3c --- /dev/null +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs @@ -0,0 +1,58 @@ +// 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.Threading.Tasks; +using Microsoft.AspNetCore.Testing; +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests +{ + public class BuildIntegrationTest11 : MSBuildIntegrationTestBase, IClassFixture + { + public BuildIntegrationTest11(BuildServerTestFixture buildServer) + : base(buildServer) + { + } + + [Fact] + [InitializeTestProject("SimpleMvc11")] + public async Task RazorSdk_DoesNotAddCoreRazorConfigurationTo11Projects() + { + var result = await DotnetMSBuild("_IntrospectProjectCapabilityItems"); + + Assert.BuildPassed(result); + Assert.BuildOutputContainsLine(result, "ProjectCapability: DotNetCoreRazor"); + Assert.BuildOutputDoesNotContainLine(result, "ProjectCapability: DotNetCoreRazorConfiguration"); + } + + [Fact (Skip = "https://github.com/aspnet/AspNetCore-Tooling/pull/1122#issuecomment-530976125")] + [InitializeTestProject("SimpleMvc11")] + public async Task RazorSdk_DoesNotBuildViewsForNetCoreApp11Projects() + { + MSBuildIntegrationTestBase.TargetFramework = "netcoreapp1.1"; + var result = await DotnetMSBuild("Build"); + + Assert.BuildPassed(result); + Assert.FileExists(result, OutputPath, "SimpleMvc11.dll"); + Assert.FileExists(result, OutputPath, "SimpleMvc11.pdb"); + Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11.Views.dll"); + Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11.Views.pdb"); + } + + [ConditionalFact] + [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] + + [InitializeTestProject("SimpleMvc11NetFx")] + public async Task RazorSdk_DoesNotBuildViewsForNetFx11Projects() + { + MSBuildIntegrationTestBase.TargetFramework = "net461"; + var result = await DotnetMSBuild("Build"); + + Assert.BuildPassed(result); + Assert.FileExists(result, OutputPath, "SimpleMvc11NetFx.exe"); + Assert.FileExists(result, OutputPath, "SimpleMvc11NetFx.pdb"); + Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11NetFx.Views.dll"); + Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11NetFx.Views.pdb"); + } + } +} diff --git a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj index 3d29b2038c..d639324487 100644 --- a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj +++ b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj @@ -4,6 +4,8 @@ + + diff --git a/src/Razor/test/testassets/SimpleMvc11/Program.cs b/src/Razor/test/testassets/SimpleMvc11/Program.cs new file mode 100644 index 0000000000..5fbbd9ded7 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Program.cs @@ -0,0 +1,13 @@ + +namespace SimpleMvc11 +{ + public class Program + { + public static void Main(string[] args) + { + // Just make sure we have a reference to MVC 1.1 + var t = typeof(Microsoft.AspNetCore.Mvc.IActionResult); + System.Console.WriteLine(t.FullName); + } + } +} diff --git a/src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj b/src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj new file mode 100644 index 0000000000..b1523f9512 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/SimpleMvc11.csproj @@ -0,0 +1,23 @@ + + + + + + + netcoreapp1.1 + + + + + + + + + All + + + + diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml new file mode 100644 index 0000000000..00afab6a0c --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Views/Home/Index.cshtml @@ -0,0 +1,108 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + + diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000000..2172e5e566 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Views/Shared/_Layout.cshtml @@ -0,0 +1,71 @@ + + + + + + @ViewData["Title"] - SimpleMvc11 + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2018 - SimpleMvc11

+
+
+ + + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..4d7ce82c24 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using SimpleMvc11 +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@inject DateTime TheTime diff --git a/src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml new file mode 100644 index 0000000000..a5f10045db --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs b/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs new file mode 100644 index 0000000000..5fbbd9ded7 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Program.cs @@ -0,0 +1,13 @@ + +namespace SimpleMvc11 +{ + public class Program + { + public static void Main(string[] args) + { + // Just make sure we have a reference to MVC 1.1 + var t = typeof(Microsoft.AspNetCore.Mvc.IActionResult); + System.Console.WriteLine(t.FullName); + } + } +} diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj b/src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj new file mode 100644 index 0000000000..b280ec0c9c --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/SimpleMvc11NetFx.csproj @@ -0,0 +1,19 @@ + + + + + + + net461 + + + + + + + + + diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml new file mode 100644 index 0000000000..00afab6a0c --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Home/Index.cshtml @@ -0,0 +1,108 @@ +@{ + ViewData["Title"] = "Home Page"; +} + + + + diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml new file mode 100644 index 0000000000..2172e5e566 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/Shared/_Layout.cshtml @@ -0,0 +1,71 @@ + + + + + + @ViewData["Title"] - SimpleMvc11 + + + + + + + + + + + + +
+ @RenderBody() +
+
+

© 2018 - SimpleMvc11

+
+
+ + + + + + + + + + + + + @RenderSection("Scripts", required: false) + + diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml new file mode 100644 index 0000000000..6f6d009d40 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewImports.cshtml @@ -0,0 +1,2 @@ +@using SimpleMvc11NetFx +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers diff --git a/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml new file mode 100644 index 0000000000..a5f10045db --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc11NetFx/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +} From ca63634583bc785a38385a838aa5419fef21f2f3 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Fri, 11 Oct 2019 15:59:13 -0700 Subject: [PATCH 2/2] unskip test \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/e5c0e3fbb3385b1f0d770445b91cf471d4738bbf --- .../test/IntegrationTests/BuildIntegrationTest11.cs | 4 ++-- .../test/Microsoft.NET.Sdk.Razor.Test.csproj | 8 ++++++++ .../RestoreTestProjects/RestoreTestProjects.csproj | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs index dc7d470a3c..eb15dbb44a 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/BuildIntegrationTest11.cs @@ -25,14 +25,14 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.BuildOutputDoesNotContainLine(result, "ProjectCapability: DotNetCoreRazorConfiguration"); } - [Fact (Skip = "https://github.com/aspnet/AspNetCore-Tooling/pull/1122#issuecomment-530976125")] + [Fact] [InitializeTestProject("SimpleMvc11")] public async Task RazorSdk_DoesNotBuildViewsForNetCoreApp11Projects() { MSBuildIntegrationTestBase.TargetFramework = "netcoreapp1.1"; var result = await DotnetMSBuild("Build"); - Assert.BuildPassed(result); + Assert.BuildPassed(result, allowWarnings: true); Assert.FileExists(result, OutputPath, "SimpleMvc11.dll"); Assert.FileExists(result, OutputPath, "SimpleMvc11.pdb"); Assert.FileDoesNotExist(result, OutputPath, "SimpleMvc11.Views.dll"); diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj b/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj index e52fbfb440..1f3678c219 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/Microsoft.NET.Sdk.Razor.Test.csproj @@ -125,6 +125,14 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests + + + + netcoreapp1.1 + net461 + + + diff --git a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj index d639324487..ab772a0f92 100644 --- a/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj +++ b/src/Razor/test/testassets/RestoreTestProjects/RestoreTestProjects.csproj @@ -4,8 +4,7 @@ - - +