From cd91ab986c16eb810f338b17fca10a2c86493d53 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Thu, 22 Jun 2017 13:12:24 -0700 Subject: [PATCH] Cleanup tests to perform fewer deployments (#154) * Cleanup tests to perform fewer deployments --- .../ApplicationConsumingPrecompiledViews.cs | 45 ------ ...cationConsumingPrecompiledViews_CoreCLR.cs | 42 ++++++ ...cationConsumingPrecompiledViews_Desktop.cs | 45 ++++++ .../ApplicationUsingRelativePathsTest.cs | 66 --------- ...plicationUsingRelativePathsTest_CoreCLR.cs | 60 ++++++++ ...plicationUsingRelativePathsTest_Desktop.cs | 63 ++++++++ .../ApplicationWithConfigureMvcTest.cs | 68 --------- ...ApplicationWithConfigureMvcTest_CoreCLR.cs | 62 ++++++++ ...ApplicationWithConfigureMvcTest_Desktop.cs | 65 +++++++++ ...icationWithCustomInputFilesTest_CoreCLR.cs | 105 ++++++++++++++ ...cationWithCustomInputFilesTest_Desktop.cs} | 72 +++++---- .../ApplicationWithParseErrorsTest_CoreCLR.cs | 50 +++++++ ...ApplicationWithParseErrorsTest_Desktop.cs} | 37 ++--- .../ApplicationWithTagHelpersTest.cs | 69 --------- .../ApplicationWithTagHelpersTest_CoreCLR.cs | 60 ++++++++ .../ApplicationWithTagHelpersTest_Desktop.cs | 63 ++++++++ test/FunctionalTests/FunctionalTests.csproj | 16 ++ .../Infrastructure/ApplicationTestFixture.cs | 85 ++++------- .../CoreCLRApplicationTestFixture.cs | 22 +++ .../DesktopApplicationTestFixture.cs | 22 +++ ...PublishWithEmbedViewSourcesTest_CoreCLR.cs | 62 ++++++++ ...ublishWithEmbedViewSourcesTest_Desktop.cs} | 42 +++--- ...ppTest.cs => RazorPagesAppTest_CoreCLR.cs} | 103 ++++++------- .../RazorPagesAppTest_Desktop.cs | 137 ++++++++++++++++++ test/FunctionalTests/RuntimeFlavors.cs | 39 ----- test/FunctionalTests/SimpleAppTest.cs | 47 ------ test/FunctionalTests/SimpleAppTest_CoreCLR.cs | 42 ++++++ test/FunctionalTests/SimpleAppTest_Desktop.cs | 45 ++++++ .../SimpleAppWithAssemblyRenameTest.cs | 54 ------- ...SimpleAppWithAssemblyRenameTest_CoreCLR.cs | 52 +++++++ ...SimpleAppWithAssemblyRenameTest_Desktop.cs | 55 +++++++ .../SimpleAppX86DesktopOnlyTest.cs | 43 ------ test/FunctionalTests/StrongNamedAppTest.cs | 47 ------ .../StrongNamedAppTest_CoreCLR.cs | 42 ++++++ .../StrongNamedAppTest_Desktop.cs | 45 ++++++ .../ViewCompilationOptionsTest.cs | 77 ---------- .../ViewCompilationOptionsTest_CoreCLR.cs | 93 ++++++++++++ .../ViewCompilationOptionsTest_Desktop.cs | 98 +++++++++++++ .../Program.cs | 2 +- .../Startup.cs | 2 +- .../Controllers/HomeController.cs | 2 +- testapps/SimpleAppDesktopOnly/Program.cs | 2 +- testapps/SimpleAppDesktopOnly/Startup.cs | 2 +- .../Views/Shared/_Layout.cshtml | 6 +- .../Views/_ViewImports.cshtml | 2 +- 45 files changed, 1504 insertions(+), 754 deletions(-) delete mode 100644 test/FunctionalTests/ApplicationConsumingPrecompiledViews.cs create mode 100644 test/FunctionalTests/ApplicationConsumingPrecompiledViews_CoreCLR.cs create mode 100644 test/FunctionalTests/ApplicationConsumingPrecompiledViews_Desktop.cs delete mode 100644 test/FunctionalTests/ApplicationUsingRelativePathsTest.cs create mode 100644 test/FunctionalTests/ApplicationUsingRelativePathsTest_CoreCLR.cs create mode 100644 test/FunctionalTests/ApplicationUsingRelativePathsTest_Desktop.cs delete mode 100644 test/FunctionalTests/ApplicationWithConfigureMvcTest.cs create mode 100644 test/FunctionalTests/ApplicationWithConfigureMvcTest_CoreCLR.cs create mode 100644 test/FunctionalTests/ApplicationWithConfigureMvcTest_Desktop.cs create mode 100644 test/FunctionalTests/ApplicationWithCustomInputFilesTest_CoreCLR.cs rename test/FunctionalTests/{ApplicationWithCustomInputFilesTest.cs => ApplicationWithCustomInputFilesTest_Desktop.cs} (56%) create mode 100644 test/FunctionalTests/ApplicationWithParseErrorsTest_CoreCLR.cs rename test/FunctionalTests/{ApplicationWithParseErrorsTest.cs => ApplicationWithParseErrorsTest_Desktop.cs} (60%) delete mode 100644 test/FunctionalTests/ApplicationWithTagHelpersTest.cs create mode 100644 test/FunctionalTests/ApplicationWithTagHelpersTest_CoreCLR.cs create mode 100644 test/FunctionalTests/ApplicationWithTagHelpersTest_Desktop.cs create mode 100644 test/FunctionalTests/Infrastructure/CoreCLRApplicationTestFixture.cs create mode 100644 test/FunctionalTests/Infrastructure/DesktopApplicationTestFixture.cs create mode 100644 test/FunctionalTests/PublishWithEmbedViewSourcesTest_CoreCLR.cs rename test/FunctionalTests/{PublishWithEmbedViewSourcesTest.cs => PublishWithEmbedViewSourcesTest_Desktop.cs} (59%) rename test/FunctionalTests/{RazorPagesAppTest.cs => RazorPagesAppTest_CoreCLR.cs} (53%) create mode 100644 test/FunctionalTests/RazorPagesAppTest_Desktop.cs delete mode 100644 test/FunctionalTests/RuntimeFlavors.cs delete mode 100644 test/FunctionalTests/SimpleAppTest.cs create mode 100644 test/FunctionalTests/SimpleAppTest_CoreCLR.cs create mode 100644 test/FunctionalTests/SimpleAppTest_Desktop.cs delete mode 100644 test/FunctionalTests/SimpleAppWithAssemblyRenameTest.cs create mode 100644 test/FunctionalTests/SimpleAppWithAssemblyRenameTest_CoreCLR.cs create mode 100644 test/FunctionalTests/SimpleAppWithAssemblyRenameTest_Desktop.cs delete mode 100644 test/FunctionalTests/SimpleAppX86DesktopOnlyTest.cs delete mode 100644 test/FunctionalTests/StrongNamedAppTest.cs create mode 100644 test/FunctionalTests/StrongNamedAppTest_CoreCLR.cs create mode 100644 test/FunctionalTests/StrongNamedAppTest_Desktop.cs delete mode 100644 test/FunctionalTests/ViewCompilationOptionsTest.cs create mode 100644 test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs create mode 100644 test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs diff --git a/test/FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/FunctionalTests/ApplicationConsumingPrecompiledViews.cs deleted file mode 100644 index 56f16d4cad..0000000000 --- a/test/FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ /dev/null @@ -1,45 +0,0 @@ -// 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.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; - -namespace FunctionalTests -{ - public class ApplicationConsumingPrecompiledViews - : IClassFixture - { - public ApplicationConsumingPrecompiledViews(ApplicationConsumingPrecompiledViewsFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task ConsumingClassLibrariesWithPrecompiledViewsWork(RuntimeFlavor flavor) - { - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync("Manage/Home", Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response); - } - } - - public class ApplicationConsumingPrecompiledViewsFixture : ApplicationTestFixture - { - public ApplicationConsumingPrecompiledViewsFixture() - : base("ApplicationUsingPrecompiledViewClassLibrary") - { - } - } - } -} \ No newline at end of file diff --git a/test/FunctionalTests/ApplicationConsumingPrecompiledViews_CoreCLR.cs b/test/FunctionalTests/ApplicationConsumingPrecompiledViews_CoreCLR.cs new file mode 100644 index 0000000000..2789080628 --- /dev/null +++ b/test/FunctionalTests/ApplicationConsumingPrecompiledViews_CoreCLR.cs @@ -0,0 +1,42 @@ +// 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.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class ApplicationConsumingPrecompiledViews_CoreCLR + : LoggedTest, IClassFixture> + { + public ApplicationConsumingPrecompiledViews_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task ConsumingClassLibrariesWithPrecompiledViewsWork() + { + // Arrange + using (StartLog(out var loggerFactory)) + { + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "Manage/Home", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response); + } + } + } +} \ No newline at end of file diff --git a/test/FunctionalTests/ApplicationConsumingPrecompiledViews_Desktop.cs b/test/FunctionalTests/ApplicationConsumingPrecompiledViews_Desktop.cs new file mode 100644 index 0000000000..7b9ea14bac --- /dev/null +++ b/test/FunctionalTests/ApplicationConsumingPrecompiledViews_Desktop.cs @@ -0,0 +1,45 @@ +// 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.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class ApplicationConsumingPrecompiledViews_Desktop + : LoggedTest, IClassFixture> + { + public ApplicationConsumingPrecompiledViews_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task ConsumingClassLibrariesWithPrecompiledViewsWork() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "Manage/Home", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response); + } + } + } +} \ No newline at end of file diff --git a/test/FunctionalTests/ApplicationUsingRelativePathsTest.cs b/test/FunctionalTests/ApplicationUsingRelativePathsTest.cs deleted file mode 100644 index 7a97609ba5..0000000000 --- a/test/FunctionalTests/ApplicationUsingRelativePathsTest.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; - -namespace FunctionalTests -{ - public class ApplicationUsingRelativePathsTest : - IClassFixture - { - public ApplicationUsingRelativePathsTest(ApplicationUsingRelativePathsTestFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForViewsUsingRelativePath(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - deployment.DeploymentResult.ApplicationBaseUri, - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response); - } - } - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForViewsUsingDirectoryTraversal(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - deployment.DeploymentResult.ApplicationBaseUri, - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response); - } - } - - public class ApplicationUsingRelativePathsTestFixture : ApplicationTestFixture - { - public ApplicationUsingRelativePathsTestFixture() - : base("ApplicationUsingRelativePaths") - { - } - } - } -} diff --git a/test/FunctionalTests/ApplicationUsingRelativePathsTest_CoreCLR.cs b/test/FunctionalTests/ApplicationUsingRelativePathsTest_CoreCLR.cs new file mode 100644 index 0000000000..e115718137 --- /dev/null +++ b/test/FunctionalTests/ApplicationUsingRelativePathsTest_CoreCLR.cs @@ -0,0 +1,60 @@ +// 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.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class ApplicationUsingRelativePathsTest_CoreCLR : + LoggedTest, IClassFixture> + { + public ApplicationUsingRelativePathsTest_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task Precompilation_WorksForViewsUsingRelativePath() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response); + } + } + + [Fact] + public async Task Precompilation_WorksForViewsUsingDirectoryTraversal() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response); + } + } + } +} diff --git a/test/FunctionalTests/ApplicationUsingRelativePathsTest_Desktop.cs b/test/FunctionalTests/ApplicationUsingRelativePathsTest_Desktop.cs new file mode 100644 index 0000000000..4122fb7b65 --- /dev/null +++ b/test/FunctionalTests/ApplicationUsingRelativePathsTest_Desktop.cs @@ -0,0 +1,63 @@ +// 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.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class ApplicationUsingRelativePathsTest_Desktop : + LoggedTest, IClassFixture> + { + public ApplicationUsingRelativePathsTest_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task Precompilation_WorksForViewsUsingRelativePath() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.Index.txt", response); + } + } + + [ConditionalFact] + public async Task Precompilation_WorksForViewsUsingDirectoryTraversal() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response); + } + } + } +} diff --git a/test/FunctionalTests/ApplicationWithConfigureMvcTest.cs b/test/FunctionalTests/ApplicationWithConfigureMvcTest.cs deleted file mode 100644 index c87fed2d14..0000000000 --- a/test/FunctionalTests/ApplicationWithConfigureMvcTest.cs +++ /dev/null @@ -1,68 +0,0 @@ -// 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.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; - -namespace FunctionalTests -{ - public class ApplicationWithConfigureMvcTest - : IClassFixture - { - public ApplicationWithConfigureMvcTest(ApplicationWithConfigureMvcFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_RunsConfiguredCompilationCallbacks(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - deployment.DeploymentResult.ApplicationBaseUri, - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response); - } - } - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_UsesConfiguredParseOptions(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - "Home/ViewWithPreprocessor", - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent( - "ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt", - response); - } - } - - public class ApplicationWithConfigureMvcFixture : ApplicationTestFixture - { - public ApplicationWithConfigureMvcFixture() - : base("ApplicationWithConfigureMvc") - { - } - } - } -} diff --git a/test/FunctionalTests/ApplicationWithConfigureMvcTest_CoreCLR.cs b/test/FunctionalTests/ApplicationWithConfigureMvcTest_CoreCLR.cs new file mode 100644 index 0000000000..0916f7af1e --- /dev/null +++ b/test/FunctionalTests/ApplicationWithConfigureMvcTest_CoreCLR.cs @@ -0,0 +1,62 @@ +// 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.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class ApplicationWithConfigureMvcTest_CoreCLR + : LoggedTest, IClassFixture> + { + public ApplicationWithConfigureMvcTest_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task Precompilation_RunsConfiguredCompilationCallbacks() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response); + } + } + + [Fact] + public async Task Precompilation_UsesConfiguredParseOptions() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/ViewWithPreprocessor", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent( + "ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt", + response); + } + } + } +} diff --git a/test/FunctionalTests/ApplicationWithConfigureMvcTest_Desktop.cs b/test/FunctionalTests/ApplicationWithConfigureMvcTest_Desktop.cs new file mode 100644 index 0000000000..5e2db02762 --- /dev/null +++ b/test/FunctionalTests/ApplicationWithConfigureMvcTest_Desktop.cs @@ -0,0 +1,65 @@ +// 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.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class ApplicationWithConfigureMvcTest_Desktop + : LoggedTest, IClassFixture> + { + public ApplicationWithConfigureMvcTest_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task Precompilation_RunsConfiguredCompilationCallbacks() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("ApplicationWithConfigureMvc.Home.Index.txt", response); + } + } + + [ConditionalFact] + public async Task Precompilation_UsesConfiguredParseOptions() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/ViewWithPreprocessor", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent( + "ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt", + response); + } + } + } +} diff --git a/test/FunctionalTests/ApplicationWithCustomInputFilesTest_CoreCLR.cs b/test/FunctionalTests/ApplicationWithCustomInputFilesTest_CoreCLR.cs new file mode 100644 index 0000000000..bce4f0a260 --- /dev/null +++ b/test/FunctionalTests/ApplicationWithCustomInputFilesTest_CoreCLR.cs @@ -0,0 +1,105 @@ +// 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.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class ApplicationWithCustomInputFilesTest_CoreCLR + : LoggedTest, IClassFixture> + { + public ApplicationWithCustomInputFilesTest_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task ApplicationWithCustomInputFiles_Works() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var expectedText = "Hello Index!"; + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + Assert.Equal(expectedText, response.Trim()); + } + } + + [Fact] + public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var expectedViews = new[] + { + "/Views/Home/About.cshtml", + "/Views/Home/Index.cshtml", + }; + + // Act + var response2 = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/GetPrecompiledResourceNames", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); + Assert.Equal(expectedViews, actual); + } + } + + [Fact] + public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var viewsNotPublished = new[] + { + "Index.cshtml", + "About.cshtml", + }; + + var viewsPublished = new[] + { + "NotIncluded.cshtml", + }; + var viewsDirectory = Path.Combine(deployment.ContentRoot, "Views", "Home"); + + // Act & Assert + foreach (var file in viewsPublished) + { + var filePath = Path.Combine(viewsDirectory, file); + Assert.True(File.Exists(filePath), $"{filePath} was not published."); + } + + foreach (var file in viewsNotPublished) + { + var filePath = Path.Combine(viewsDirectory, file); + Assert.False(File.Exists(filePath), $"{filePath} was published."); + } + } + } + } +} diff --git a/test/FunctionalTests/ApplicationWithCustomInputFilesTest.cs b/test/FunctionalTests/ApplicationWithCustomInputFilesTest_Desktop.cs similarity index 56% rename from test/FunctionalTests/ApplicationWithCustomInputFilesTest.cs rename to test/FunctionalTests/ApplicationWithCustomInputFilesTest_Desktop.cs index 364fc37f9f..cd519e5518 100644 --- a/test/FunctionalTests/ApplicationWithCustomInputFilesTest.cs +++ b/test/FunctionalTests/ApplicationWithCustomInputFilesTest_Desktop.cs @@ -5,62 +5,64 @@ using System; using System.IO; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging.Testing; using Xunit; +using Xunit.Abstractions; namespace FunctionalTests { - public class ApplicationWithCustomInputFilesTest - : IClassFixture + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class ApplicationWithCustomInputFilesTest_Desktop + : LoggedTest, IClassFixture> { - private const string ApplicationName = "ApplicationWithCustomInputFiles"; - - public ApplicationWithCustomInputFilesTest(ApplicationWithCustomInputFilesTestFixture fixture) + public ApplicationWithCustomInputFilesTest_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) { Fixture = fixture; } public ApplicationTestFixture Fixture { get; } - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task ApplicationWithCustomInputFiles_Works(RuntimeFlavor flavor) + [ConditionalFact] + public async Task ApplicationWithCustomInputFiles_Works() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); var expectedText = "Hello Index!"; // Act var response = await deployment.HttpClient.GetStringWithRetryAsync( - deployment.DeploymentResult.ApplicationBaseUri, - Fixture.Logger); + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); // Assert Assert.Equal(expectedText, response.Trim()); } } - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled(RuntimeFlavor flavor) + [ConditionalFact] + public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); var expectedViews = new[] - { - "/Views/Home/About.cshtml", - "/Views/Home/Index.cshtml", - }; + { + "/Views/Home/About.cshtml", + "/Views/Home/Index.cshtml", + }; // Act var response2 = await deployment.HttpClient.GetStringWithRetryAsync( "Home/GetPrecompiledResourceNames", - Fixture.Logger); + loggerFactory.CreateLogger(Fixture.ApplicationName)); // Assert var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) @@ -69,13 +71,13 @@ namespace FunctionalTests } } - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled(RuntimeFlavor flavor) + [ConditionalFact] + public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); var viewsNotPublished = new[] { "Index.cshtml", @@ -86,7 +88,7 @@ namespace FunctionalTests { "NotIncluded.cshtml", }; - var viewsDirectory = Path.Combine(deployment.DeploymentResult.ContentRoot, "Views", "Home"); + var viewsDirectory = Path.Combine(deployment.ContentRoot, "Views", "Home"); // Act & Assert foreach (var file in viewsPublished) @@ -102,13 +104,5 @@ namespace FunctionalTests } } } - - public class ApplicationWithCustomInputFilesTestFixture : ApplicationTestFixture - { - public ApplicationWithCustomInputFilesTestFixture() - : base(ApplicationWithCustomInputFilesTest.ApplicationName) - { - } - } } } diff --git a/test/FunctionalTests/ApplicationWithParseErrorsTest_CoreCLR.cs b/test/FunctionalTests/ApplicationWithParseErrorsTest_CoreCLR.cs new file mode 100644 index 0000000000..77159e5e13 --- /dev/null +++ b/test/FunctionalTests/ApplicationWithParseErrorsTest_CoreCLR.cs @@ -0,0 +1,50 @@ +// 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.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging.Testing; +using Xunit; + +namespace FunctionalTests +{ + public class ApplicationWithParseErrorsTest_CoreCLR + : IClassFixture> + { + public ApplicationWithParseErrorsTest_CoreCLR(CoreCLRApplicationTestFixture fixture) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task PublishingPrintsParseErrors() + { + // Arrange + var applicationPath = ApplicationPaths.GetTestAppDirectory("ApplicationWithParseErrors"); + var indexPath = Path.Combine(applicationPath, "Views", "Home", "Index.cshtml"); + var viewImportsPath = Path.Combine(applicationPath, "Views", "Home", "About.cshtml"); + var expectedErrors = new[] + { + indexPath + " (0): The code block is missing a closing \"}\" character. Make sure you have a matching \"}\" character for all the \"{\" characters within this block, and that none of the \"}\" characters are being interpreted as markup.", + viewImportsPath + " (1): A space or line break was encountered after the \"@\" character. Only valid identifiers, keywords, comments, \"(\" and \"{\" are valid at the start of a code block and they must occur immediately following \"@\" with no space in between.", + + }; + var testSink = new TestSink(); + var loggerFactory = new TestLoggerFactory(testSink, enabled: true); + + // Act + await Assert.ThrowsAsync(() => Fixture.CreateDeploymentAsync(loggerFactory)); + + // Assert + var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList(); + foreach (var expectedError in expectedErrors) + { + Assert.Contains(logs, log => log.Contains(expectedError)); + } + } + } +} diff --git a/test/FunctionalTests/ApplicationWithParseErrorsTest.cs b/test/FunctionalTests/ApplicationWithParseErrorsTest_Desktop.cs similarity index 60% rename from test/FunctionalTests/ApplicationWithParseErrorsTest.cs rename to test/FunctionalTests/ApplicationWithParseErrorsTest_Desktop.cs index 5cce007f11..587cbd9b32 100644 --- a/test/FunctionalTests/ApplicationWithParseErrorsTest.cs +++ b/test/FunctionalTests/ApplicationWithParseErrorsTest_Desktop.cs @@ -5,20 +5,26 @@ using System; using System.IO; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging.Testing; using Xunit; namespace FunctionalTests { - public class ApplicationWithParseErrorsTest + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class ApplicationWithParseErrorsTest_Desktop + : IClassFixture> { - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; + public ApplicationWithParseErrorsTest_Desktop(DesktopApplicationTestFixture fixture) + { + Fixture = fixture; + } - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task PublishingPrintsParseErrors(RuntimeFlavor flavor) + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task PublishingPrintsParseErrors() { // Arrange var applicationPath = ApplicationPaths.GetTestAppDirectory("ApplicationWithParseErrors"); @@ -31,19 +37,16 @@ namespace FunctionalTests }; var testSink = new TestSink(); - var deploymentParameters = ApplicationTestFixture.GetDeploymentParameters(applicationPath, flavor); var loggerFactory = new TestLoggerFactory(testSink, enabled: true); - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) - { - // Act - await Assert.ThrowsAsync(() => deployer.DeployAsync()); - // Assert - var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList(); - foreach (var expectedError in expectedErrors) - { - Assert.Contains(logs, log => log.Contains(expectedError)); - } + // Act + await Assert.ThrowsAsync(() => Fixture.CreateDeploymentAsync(loggerFactory)); + + // Assert + var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList(); + foreach (var expectedError in expectedErrors) + { + Assert.Contains(logs, log => log.Contains(expectedError)); } } } diff --git a/test/FunctionalTests/ApplicationWithTagHelpersTest.cs b/test/FunctionalTests/ApplicationWithTagHelpersTest.cs deleted file mode 100644 index 1db1d0540b..0000000000 --- a/test/FunctionalTests/ApplicationWithTagHelpersTest.cs +++ /dev/null @@ -1,69 +0,0 @@ -// 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.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; -using Xunit; - -namespace FunctionalTests -{ - public class TagHelperTest : IClassFixture - { - public TagHelperTest(ApplicationWithTagHelpersFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - public static TheoryData ApplicationWithTagHelpersData - { - get - { - var urls = new[] - { - "ClassLibraryTagHelper", - "LocalTagHelper", - }; - - var data = new TheoryData(); - foreach (var runtimeFlavor in RuntimeFlavors.SupportedFlavors) - { - foreach(var url in urls) - { - data.Add(url, runtimeFlavor); - } - } - - return data; - } - } - - [Theory] - [MemberData(nameof(ApplicationWithTagHelpersData))] - public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url, RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - $"Home/{url}", - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response); - } - } - - public class ApplicationWithTagHelpersFixture : ApplicationTestFixture - { - public ApplicationWithTagHelpersFixture() - : base("ApplicationWithTagHelpers") - { - } - } - } -} diff --git a/test/FunctionalTests/ApplicationWithTagHelpersTest_CoreCLR.cs b/test/FunctionalTests/ApplicationWithTagHelpersTest_CoreCLR.cs new file mode 100644 index 0000000000..b1d3664da6 --- /dev/null +++ b/test/FunctionalTests/ApplicationWithTagHelpersTest_CoreCLR.cs @@ -0,0 +1,60 @@ +// 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.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class ApplicationWithTagHelpersTest_CoreCLR : + LoggedTest, IClassFixture> + { + public ApplicationWithTagHelpersTest_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task Precompilation_WorksForViewsThatUseTagHelpersFromProjectReferences() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/ClassLibraryTagHelper", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt", response); + } + } + + [Fact] + public async Task Precompilation_WorksForViewsThatUseTagHelpersFromCurrentProject() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/LocalTagHelper", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.LocalTagHelper.txt", response); + } + } + } +} diff --git a/test/FunctionalTests/ApplicationWithTagHelpersTest_Desktop.cs b/test/FunctionalTests/ApplicationWithTagHelpersTest_Desktop.cs new file mode 100644 index 0000000000..8b3508be2b --- /dev/null +++ b/test/FunctionalTests/ApplicationWithTagHelpersTest_Desktop.cs @@ -0,0 +1,63 @@ +// 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.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class ApplicationWithTagHelpersTest_Desktop : + LoggedTest, IClassFixture> + { + public ApplicationWithTagHelpersTest_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task Precompilation_WorksForViewsThatUseTagHelpersFromProjectReferences() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/ClassLibraryTagHelper", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt", response); + } + } + + [ConditionalFact] + public async Task Precompilation_WorksForViewsThatUseTagHelpersFromCurrentProject() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/LocalTagHelper", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.LocalTagHelper.txt", response); + } + } + } +} diff --git a/test/FunctionalTests/FunctionalTests.csproj b/test/FunctionalTests/FunctionalTests.csproj index 98d252dde6..6ff604c642 100644 --- a/test/FunctionalTests/FunctionalTests.csproj +++ b/test/FunctionalTests/FunctionalTests.csproj @@ -6,6 +6,8 @@ netcoreapp2.0 $(DefineConstants);__remove_this_to__GENERATE_BASELINES $(DefineConstants);GENERATE_BASELINES + false + false @@ -23,4 +25,18 @@ + + + + + + + + + + + + + + diff --git a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs index b5cb8e9434..83ba729400 100644 --- a/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using System.IO; -using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.Extensions.Logging; @@ -13,40 +11,36 @@ namespace FunctionalTests { public abstract class ApplicationTestFixture : IDisposable { - public const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT"; + private const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT"; + private readonly object _deploymentLock = new object(); + private Task _deploymentTask; + private IApplicationDeployer _deployer; - protected ApplicationTestFixture(string applicationName) + protected ApplicationTestFixture(string applicationName, string applicationPath) { ApplicationName = applicationName; - LoggerFactory = CreateLoggerFactory(); - Logger = LoggerFactory.CreateLogger($"{ApplicationName}"); + ApplicationPath = applicationPath ?? ApplicationPaths.GetTestAppDirectory(applicationName); } public string ApplicationName { get; } - public string ApplicationPath => ApplicationPaths.GetTestAppDirectory(ApplicationName); + public string ApplicationPath { get; } - public ILogger Logger { get; private set; } + protected abstract DeploymentParameters GetDeploymentParameters(); - public ILoggerFactory LoggerFactory { get; private set; } - - public virtual DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor) - { - return GetDeploymentParameters(ApplicationPath, flavor); - } - - public static DeploymentParameters GetDeploymentParameters(string applicationPath, RuntimeFlavor flavor) + protected DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor) { var telemetryOptOut = new KeyValuePair( DotnetCLITelemetryOptOut, "1"); var deploymentParameters = new DeploymentParameters( - applicationPath, + ApplicationPath, ServerType.Kestrel, flavor, RuntimeArchitecture.x64) { + ApplicationName = ApplicationName, PublishApplicationBeforeDeployment = true, TargetFramework = flavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0", #if DEBUG @@ -67,56 +61,29 @@ namespace FunctionalTests return deploymentParameters; } - public virtual ILoggerFactory CreateLoggerFactory() - { - return new LoggerFactory().AddConsole(); - } - public void Dispose() { + if (_deploymentTask?.Status == TaskStatus.RanToCompletion) + { + _deploymentTask.Result.HttpClient?.Dispose(); + } + + _deployer?.Dispose(); } - private static void TryDeleteDirectory(string directory) + public async Task CreateDeploymentAsync(ILoggerFactory loggerFactory) { - try + lock (_deploymentLock) { - Directory.Delete(directory, recursive: true); - } - catch (IOException) - { - // Ignore delete failures. - } - } - - public async Task CreateDeploymentAsync(RuntimeFlavor flavor) - { - var deploymentParameters = GetDeploymentParameters(flavor); - var deployer = ApplicationDeployerFactory.Create(deploymentParameters, LoggerFactory); - var deploymentResult = await deployer.DeployAsync(); - - return new Deployment(deployer, deploymentResult); - } - - public class Deployment : IDisposable - { - public Deployment(IApplicationDeployer deployer, DeploymentResult deploymentResult) - { - Deployer = deployer; - DeploymentResult = deploymentResult; - HttpClient = deploymentResult.HttpClient; + if (_deploymentTask == null) + { + var deploymentParameters = GetDeploymentParameters(); + _deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory); + _deploymentTask = _deployer.DeployAsync(); + } } - public IApplicationDeployer Deployer { get; } - - public HttpClient HttpClient { get; } - - public DeploymentResult DeploymentResult { get; } - - public void Dispose() - { - Deployer.Dispose(); - HttpClient.Dispose(); - } + return await _deploymentTask; } } } diff --git a/test/FunctionalTests/Infrastructure/CoreCLRApplicationTestFixture.cs b/test/FunctionalTests/Infrastructure/CoreCLRApplicationTestFixture.cs new file mode 100644 index 0000000000..6f4c8625df --- /dev/null +++ b/test/FunctionalTests/Infrastructure/CoreCLRApplicationTestFixture.cs @@ -0,0 +1,22 @@ +// 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.AspNetCore.Server.IntegrationTesting; + +namespace FunctionalTests +{ + public class CoreCLRApplicationTestFixture : ApplicationTestFixture + { + public CoreCLRApplicationTestFixture() + : this(typeof(TStartup).Assembly.GetName().Name, null) + { + } + + protected CoreCLRApplicationTestFixture(string applicationName, string applicationPath) + : base(applicationName, applicationPath) + { + } + + protected override DeploymentParameters GetDeploymentParameters() => base.GetDeploymentParameters(RuntimeFlavor.CoreClr); + } +} diff --git a/test/FunctionalTests/Infrastructure/DesktopApplicationTestFixture.cs b/test/FunctionalTests/Infrastructure/DesktopApplicationTestFixture.cs new file mode 100644 index 0000000000..7e3579a017 --- /dev/null +++ b/test/FunctionalTests/Infrastructure/DesktopApplicationTestFixture.cs @@ -0,0 +1,22 @@ +// 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.AspNetCore.Server.IntegrationTesting; + +namespace FunctionalTests +{ + public class DesktopApplicationTestFixture : ApplicationTestFixture + { + public DesktopApplicationTestFixture() + : this(typeof(TStartup).Assembly.GetName().Name, null) + { + } + + protected DesktopApplicationTestFixture(string applicationName, string applicationPath) + : base(applicationName, applicationPath) + { + } + + protected override DeploymentParameters GetDeploymentParameters() => base.GetDeploymentParameters(RuntimeFlavor.Clr); + } +} diff --git a/test/FunctionalTests/PublishWithEmbedViewSourcesTest_CoreCLR.cs b/test/FunctionalTests/PublishWithEmbedViewSourcesTest_CoreCLR.cs new file mode 100644 index 0000000000..b6a3e54ae7 --- /dev/null +++ b/test/FunctionalTests/PublishWithEmbedViewSourcesTest_CoreCLR.cs @@ -0,0 +1,62 @@ +// 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.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class PublishWithEmbedViewSourcesTest_CoreCLR + : LoggedTest, IClassFixture> + { + public PublishWithEmbedViewSourcesTest_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task Precompilation_CanEmbedViewSourcesAsResources() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var logger = loggerFactory.CreateLogger(Fixture.ApplicationName); + var expectedViews = new[] + { + "/Areas/TestArea/Views/Home/Index.cshtml", + "/Views/Home/About.cshtml", + "/Views/Home/Index.cshtml", + }; + var expectedText = "Hello Index!"; + + // Act - 1 + var response1 = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/Index", + logger); + + // Assert - 1 + Assert.Equal(expectedText, response1.Trim()); + + // Act - 2 + var response2 = await deployment.HttpClient.GetStringWithRetryAsync( + "Home/GetPrecompiledResourceNames", + logger); + + // Assert - 2 + var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) + .OrderBy(p => p, StringComparer.OrdinalIgnoreCase); + Assert.Equal(expectedViews, actual); + } + } + } +} diff --git a/test/FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/FunctionalTests/PublishWithEmbedViewSourcesTest_Desktop.cs similarity index 59% rename from test/FunctionalTests/PublishWithEmbedViewSourcesTest.cs rename to test/FunctionalTests/PublishWithEmbedViewSourcesTest_Desktop.cs index 6ce51fab2f..eea2b45da7 100644 --- a/test/FunctionalTests/PublishWithEmbedViewSourcesTest.cs +++ b/test/FunctionalTests/PublishWithEmbedViewSourcesTest_Desktop.cs @@ -2,36 +2,38 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.IO; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging.Testing; using Xunit; +using Xunit.Abstractions; namespace FunctionalTests { - public class PublishWithEmbedViewSourcesTest - : IClassFixture + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class PublishWithEmbedViewSourcesTest_Desktop + : LoggedTest, IClassFixture> { - private const string ApplicationName = "PublishWithEmbedViewSources"; - - public PublishWithEmbedViewSourcesTest(PublishWithEmbedViewSourcesTestFixture fixture) + public PublishWithEmbedViewSourcesTest_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) { Fixture = fixture; } public ApplicationTestFixture Fixture { get; } - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_CanEmbedViewSourcesAsResources(RuntimeFlavor flavor) + [ConditionalFact] + public async Task Precompilation_CanEmbedViewSourcesAsResources() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var logger = loggerFactory.CreateLogger(Fixture.ApplicationName); var expectedViews = new[] { "/Areas/TestArea/Views/Home/Index.cshtml", @@ -43,7 +45,7 @@ namespace FunctionalTests // Act - 1 var response1 = await deployment.HttpClient.GetStringWithRetryAsync( "Home/Index", - Fixture.Logger); + logger); // Assert - 1 Assert.Equal(expectedText, response1.Trim()); @@ -51,7 +53,7 @@ namespace FunctionalTests // Act - 2 var response2 = await deployment.HttpClient.GetStringWithRetryAsync( "Home/GetPrecompiledResourceNames", - Fixture.Logger); + logger); // Assert - 2 var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) @@ -59,13 +61,5 @@ namespace FunctionalTests Assert.Equal(expectedViews, actual); } } - - public class PublishWithEmbedViewSourcesTestFixture : ApplicationTestFixture - { - public PublishWithEmbedViewSourcesTestFixture() - : base(PublishWithEmbedViewSourcesTest.ApplicationName) - { - } - } } } diff --git a/test/FunctionalTests/RazorPagesAppTest.cs b/test/FunctionalTests/RazorPagesAppTest_CoreCLR.cs similarity index 53% rename from test/FunctionalTests/RazorPagesAppTest.cs rename to test/FunctionalTests/RazorPagesAppTest_CoreCLR.cs index 5b6b65e834..281cf046b3 100644 --- a/test/FunctionalTests/RazorPagesAppTest.cs +++ b/test/FunctionalTests/RazorPagesAppTest_CoreCLR.cs @@ -3,131 +3,132 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging.Testing; using Xunit; +using Xunit.Abstractions; namespace FunctionalTests { - public class RazorPagesAppTest : IClassFixture + public class RazorPagesAppTest_CoreCLR : + LoggedTest, IClassFixture> { - public RazorPagesAppTest(TestFixture fixture) + public RazorPagesAppTest_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) { Fixture = fixture; } public ApplicationTestFixture Fixture { get; } - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForIndexPage_UsingFolderName(RuntimeFlavor flavor) + [Fact] + public async Task Precompilation_WorksForIndexPage_UsingFolderName() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + // Act var response = await deployment.HttpClient.GetStringWithRetryAsync( "/", - Fixture.Logger); + loggerFactory.CreateLogger(Fixture.ApplicationName)); // Assert TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response); } } - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForIndexPage_UsingFileName(RuntimeFlavor flavor) + [Fact] + public async Task Precompilation_WorksForIndexPage_UsingFileName() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + // Act var response = await deployment.HttpClient.GetStringWithRetryAsync( "/Index", - Fixture.Logger); + loggerFactory.CreateLogger(Fixture.ApplicationName)); // Assert TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response); } } - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForPageWithModel(RuntimeFlavor flavor) + [Fact] + public async Task Precompilation_WorksForPageWithModel() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + // Act var response = await deployment.HttpClient.GetStringWithRetryAsync( "/PageWithModel?person=Dan", - Fixture.Logger); + loggerFactory.CreateLogger(Fixture.ApplicationName)); // Assert TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response); } } - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForPageWithRoute(RuntimeFlavor flavor) + [Fact] + public async Task Precompilation_WorksForPageWithRoute() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + // Act var response = await deployment.HttpClient.GetStringWithRetryAsync( "/PageWithRoute/Dan", - Fixture.Logger); + loggerFactory.CreateLogger(Fixture.ApplicationName)); // Assert TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response); } } - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForPageInNestedFolder(RuntimeFlavor flavor) + [Fact] + public async Task Precompilation_WorksForPageInNestedFolder() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + // Act var response = await deployment.HttpClient.GetStringWithRetryAsync( "/Nested1/Nested2/PageWithTagHelper", - Fixture.Logger); + loggerFactory.CreateLogger(Fixture.ApplicationName)); // Assert TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response); } } - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksWithPageConventions(RuntimeFlavor flavor) + [Fact] + public async Task Precompilation_WorksWithPageConventions() { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) + using (StartLog(out var loggerFactory)) { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + // Act var response = await RetryHelper.RetryRequest( - () => deployment.HttpClient.GetAsync("/Auth/Index"), - Fixture.Logger, - retryCount: 5); + () => deployment.HttpClient.GetAsync("/Auth/Index"), + loggerFactory.CreateLogger(Fixture.ApplicationName), + retryCount: 5); // Assert Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery); } } - - public class TestFixture : ApplicationTestFixture - { - public TestFixture() - : base("RazorPagesApp") - { - } - } } } diff --git a/test/FunctionalTests/RazorPagesAppTest_Desktop.cs b/test/FunctionalTests/RazorPagesAppTest_Desktop.cs new file mode 100644 index 0000000000..bbdf42bdaf --- /dev/null +++ b/test/FunctionalTests/RazorPagesAppTest_Desktop.cs @@ -0,0 +1,137 @@ +// 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.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class RazorPagesAppTest_Desktop : + LoggedTest, IClassFixture> + { + public RazorPagesAppTest_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task Precompilation_WorksForIndexPage_UsingFolderName() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "/", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response); + } + } + + [ConditionalFact] + public async Task Precompilation_WorksForIndexPage_UsingFileName() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "/Index", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response); + } + } + + [ConditionalFact] + public async Task Precompilation_WorksForPageWithModel() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "/PageWithModel?person=Dan", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response); + } + } + + [ConditionalFact] + public async Task Precompilation_WorksForPageWithRoute() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "/PageWithRoute/Dan", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response); + } + } + + [ConditionalFact] + public async Task Precompilation_WorksForPageInNestedFolder() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + "/Nested1/Nested2/PageWithTagHelper", + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response); + } + } + + [ConditionalFact] + public async Task Precompilation_WorksWithPageConventions() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await RetryHelper.RetryRequest( + () => deployment.HttpClient.GetAsync("/Auth/Index"), + loggerFactory.CreateLogger(Fixture.ApplicationName), + retryCount: 5); + + // Assert + Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery); + } + } + } +} diff --git a/test/FunctionalTests/RuntimeFlavors.cs b/test/FunctionalTests/RuntimeFlavors.cs deleted file mode 100644 index e94c200d8f..0000000000 --- a/test/FunctionalTests/RuntimeFlavors.cs +++ /dev/null @@ -1,39 +0,0 @@ -// 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.Collections.Generic; -using System.Runtime.InteropServices; -using Microsoft.AspNetCore.Server.IntegrationTesting; -using Xunit; - -namespace FunctionalTests -{ - public static class RuntimeFlavors - { - public static IEnumerable SupportedFlavors - { - get - { - yield return RuntimeFlavor.CoreClr; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - yield return RuntimeFlavor.Clr; - } - } - } - - public static TheoryData SupportedFlavorsTheoryData - { - get - { - var theory = new TheoryData(); - foreach (var item in SupportedFlavors) - { - theory.Add(item); - } - - return theory; - } - } - } -} \ No newline at end of file diff --git a/test/FunctionalTests/SimpleAppTest.cs b/test/FunctionalTests/SimpleAppTest.cs deleted file mode 100644 index dbbe002ae8..0000000000 --- a/test/FunctionalTests/SimpleAppTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; - -namespace FunctionalTests -{ - public class SimpleAppTest : IClassFixture - { - public SimpleAppTest(SimpleAppTestFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - deployment.DeploymentResult.ApplicationBaseUri, - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); - } - } - - public class SimpleAppTestFixture : ApplicationTestFixture - { - public SimpleAppTestFixture() - : base("SimpleApp") - { - } - } - } -} diff --git a/test/FunctionalTests/SimpleAppTest_CoreCLR.cs b/test/FunctionalTests/SimpleAppTest_CoreCLR.cs new file mode 100644 index 0000000000..18e17b588e --- /dev/null +++ b/test/FunctionalTests/SimpleAppTest_CoreCLR.cs @@ -0,0 +1,42 @@ +// 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.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class SimpleAppTest_CoreCLR : + LoggedTest, IClassFixture> + { + public SimpleAppTest_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task Precompilation_WorksForSimpleApps() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); + } + } + } +} diff --git a/test/FunctionalTests/SimpleAppTest_Desktop.cs b/test/FunctionalTests/SimpleAppTest_Desktop.cs new file mode 100644 index 0000000000..45c1731287 --- /dev/null +++ b/test/FunctionalTests/SimpleAppTest_Desktop.cs @@ -0,0 +1,45 @@ +// 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.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class SimpleAppTest_Desktop : + LoggedTest, IClassFixture> + { + public SimpleAppTest_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task Precompilation_WorksForSimpleApps() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); + } + } + } +} diff --git a/test/FunctionalTests/SimpleAppWithAssemblyRenameTest.cs b/test/FunctionalTests/SimpleAppWithAssemblyRenameTest.cs deleted file mode 100644 index e11dc55ac2..0000000000 --- a/test/FunctionalTests/SimpleAppWithAssemblyRenameTest.cs +++ /dev/null @@ -1,54 +0,0 @@ -// 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.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; - -namespace FunctionalTests -{ - public class SimpleAppWithAssemblyRenameTest : IClassFixture - { - public SimpleAppWithAssemblyRenameTest(TestFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - deployment.DeploymentResult.ApplicationBaseUri, - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response); - } - } - - public class TestFixture : ApplicationTestFixture - { - public TestFixture() - : base("SimpleAppWithAssemblyRename") - { - } - - public override DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor) - { - var parameters = base.GetDeploymentParameters(flavor); - parameters.ApplicationName = "NewAssemblyName"; - return parameters; - } - } - } -} diff --git a/test/FunctionalTests/SimpleAppWithAssemblyRenameTest_CoreCLR.cs b/test/FunctionalTests/SimpleAppWithAssemblyRenameTest_CoreCLR.cs new file mode 100644 index 0000000000..dddd8cf097 --- /dev/null +++ b/test/FunctionalTests/SimpleAppWithAssemblyRenameTest_CoreCLR.cs @@ -0,0 +1,52 @@ +// 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.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class SimpleAppWithAssemblyRenameTest_CoreCLR : + LoggedTest, IClassFixture + { + public SimpleAppWithAssemblyRenameTest_CoreCLR( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task Precompilation_WorksForSimpleApps() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response); + } + } + + public class TestFixture : CoreCLRApplicationTestFixture + { + public TestFixture() + : base( + typeof(SimpleAppWithAssemblyRename.Startup).Assembly.GetName().Name, + ApplicationPaths.GetTestAppDirectory(nameof(SimpleAppWithAssemblyRename))) + { + } + } + } +} diff --git a/test/FunctionalTests/SimpleAppWithAssemblyRenameTest_Desktop.cs b/test/FunctionalTests/SimpleAppWithAssemblyRenameTest_Desktop.cs new file mode 100644 index 0000000000..bb16ce3dea --- /dev/null +++ b/test/FunctionalTests/SimpleAppWithAssemblyRenameTest_Desktop.cs @@ -0,0 +1,55 @@ +// 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.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class SimpleAppWithAssemblyRenameTest_Desktop : + LoggedTest, IClassFixture + { + public SimpleAppWithAssemblyRenameTest_Desktop( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task Precompilation_WorksForSimpleApps() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response); + } + } + + public class TestFixture : DesktopApplicationTestFixture + { + public TestFixture() + : base( + typeof(SimpleAppWithAssemblyRename.Startup).Assembly.GetName().Name, + ApplicationPaths.GetTestAppDirectory(nameof(SimpleAppWithAssemblyRename))) + { + } + } + } +} diff --git a/test/FunctionalTests/SimpleAppX86DesktopOnlyTest.cs b/test/FunctionalTests/SimpleAppX86DesktopOnlyTest.cs deleted file mode 100644 index 872ce2d37e..0000000000 --- a/test/FunctionalTests/SimpleAppX86DesktopOnlyTest.cs +++ /dev/null @@ -1,43 +0,0 @@ -// 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.Server.IntegrationTesting; -using Xunit; - -namespace FunctionalTests -{ - public class SimpleAppX86DesktopOnlyTest : IClassFixture - { - public SimpleAppX86DesktopOnlyTest(SimpleAppX86DesktopOnlyFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - [Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/134")] - public async Task Precompilation_WorksForSimpleApps() - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(RuntimeFlavor.Clr)) - { - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - deployment.DeploymentResult.ApplicationBaseUri, - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent("SimpleAppX86DesktopOnly.Home.Index.txt", response); - } - } - - public class SimpleAppX86DesktopOnlyFixture : ApplicationTestFixture - { - public SimpleAppX86DesktopOnlyFixture() - : base("SimpleAppX86DesktopOnly") - { - } - } - } -} \ No newline at end of file diff --git a/test/FunctionalTests/StrongNamedAppTest.cs b/test/FunctionalTests/StrongNamedAppTest.cs deleted file mode 100644 index c8c5018b9c..0000000000 --- a/test/FunctionalTests/StrongNamedAppTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; - -namespace FunctionalTests -{ - public class StrongNamedAppTest : IClassFixture - { - public StrongNamedAppTest(StrongNamedAppFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task PrecompiledAssembliesUseSameStrongNameAsApplication(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - // Act - var response = await deployment.HttpClient.GetStringWithRetryAsync( - deployment.DeploymentResult.ApplicationBaseUri, - Fixture.Logger); - - // Assert - TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response); - } - } - - public class StrongNamedAppFixture : ApplicationTestFixture - { - public StrongNamedAppFixture() - : base("StrongNamedApp") - { - } - } - } -} diff --git a/test/FunctionalTests/StrongNamedAppTest_CoreCLR.cs b/test/FunctionalTests/StrongNamedAppTest_CoreCLR.cs new file mode 100644 index 0000000000..4559a416fa --- /dev/null +++ b/test/FunctionalTests/StrongNamedAppTest_CoreCLR.cs @@ -0,0 +1,42 @@ +// 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.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class StrongNamedAppTest_CoreCLR : + LoggedTest, IClassFixture> + { + public StrongNamedAppTest_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task PrecompiledAssembliesUseSameStrongNameAsApplication() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response); + } + } + } +} diff --git a/test/FunctionalTests/StrongNamedAppTest_Desktop.cs b/test/FunctionalTests/StrongNamedAppTest_Desktop.cs new file mode 100644 index 0000000000..16f63fbe3b --- /dev/null +++ b/test/FunctionalTests/StrongNamedAppTest_Desktop.cs @@ -0,0 +1,45 @@ +// 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.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class StrongNamedAppTest_Desktop : + LoggedTest, IClassFixture> + { + public StrongNamedAppTest_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task PrecompiledAssembliesUseSameStrongNameAsApplication() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act + var response = await deployment.HttpClient.GetStringWithRetryAsync( + deployment.ApplicationBaseUri, + loggerFactory.CreateLogger(Fixture.ApplicationName)); + + // Assert + TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response); + } + } + } +} diff --git a/test/FunctionalTests/ViewCompilationOptionsTest.cs b/test/FunctionalTests/ViewCompilationOptionsTest.cs deleted file mode 100644 index 632aec8459..0000000000 --- a/test/FunctionalTests/ViewCompilationOptionsTest.cs +++ /dev/null @@ -1,77 +0,0 @@ -// 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.Collections.Generic; -using System.IO; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.AspNetCore.Testing.xunit; -using Xunit; - -namespace FunctionalTests -{ - public class ViewCompilationOptionsTest : IClassFixture - { - public ViewCompilationOptionsTest(TestFixture fixture) - { - Fixture = fixture; - } - - public ApplicationTestFixture Fixture { get; } - - public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData; - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_PreventsRefAssembliesFromBeingPublished(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - // Act & Assert - Assert.False(Directory.Exists(Path.Combine(deployment.DeploymentResult.ContentRoot, "refs"))); - } - } - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task PublishingWithOption_AllowsPublishingRefAssemblies(RuntimeFlavor flavor) - { - // Arrange - var deploymentParameters = Fixture.GetDeploymentParameters(flavor); - deploymentParameters.PublishEnvironmentVariables.Add( - new KeyValuePair("MvcRazorExcludeRefAssembliesFromPublish", "false")); - - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Fixture.LoggerFactory)) - { - // Act - var deploymentResult = await deployer.DeployAsync(); - - // Assert - Assert.True(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs"))); - } - } - - [ConditionalTheory] - [MemberData(nameof(SupportedFlavorsTheoryData))] - public async Task Precompilation_PublishesPdbsToOutputDirectory(RuntimeFlavor flavor) - { - // Arrange - using (var deployment = await Fixture.CreateDeploymentAsync(flavor)) - { - var pdbPath = Path.Combine(deployment.DeploymentResult.ContentRoot, Fixture.ApplicationName + ".PrecompiledViews.pdb"); - - // Act & Assert - Assert.True(File.Exists(pdbPath), $"PDB at {pdbPath} was not found."); - } - } - - public class TestFixture : ApplicationTestFixture - { - public TestFixture() - : base("SimpleApp") - { - } - } - } -} diff --git a/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs b/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs new file mode 100644 index 0000000000..ab4dc0d6e3 --- /dev/null +++ b/test/FunctionalTests/ViewCompilationOptionsTest_CoreCLR.cs @@ -0,0 +1,93 @@ +// 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.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + public class ViewCompilationOptions_CoreCLR : + LoggedTest, IClassFixture> + { + public ViewCompilationOptions_CoreCLR( + CoreCLRApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task Precompilation_PreventsRefAssembliesFromBeingPublished() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + Assert.False(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs"))); + } + } + + [Fact] + public async Task Precompilation_PublishesPdbsToOutputDirectory() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var pdbPath = Path.Combine(deployment.ContentRoot, Fixture.ApplicationName + ".PrecompiledViews.pdb"); + + // Act & Assert + Assert.True(File.Exists(pdbPath), $"PDB at {pdbPath} was not found."); + } + } + } + + public class ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished : + LoggedTest, IClassFixture + { + public ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [Fact] + public async Task PublishingWithOption_AllowsPublishingRefAssemblies() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + Assert.True(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs"))); + } + } + + public class TestFixture : CoreCLRApplicationTestFixture + { + protected override DeploymentParameters GetDeploymentParameters() + { + var deploymentParameters = base.GetDeploymentParameters(); + deploymentParameters.PublishEnvironmentVariables.Add( + new KeyValuePair("MvcRazorExcludeRefAssembliesFromPublish", "false")); + + return deploymentParameters; + } + } + } +} diff --git a/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs b/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs new file mode 100644 index 0000000000..e4a80533f1 --- /dev/null +++ b/test/FunctionalTests/ViewCompilationOptionsTest_Desktop.cs @@ -0,0 +1,98 @@ +// 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.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing.xunit; +using Microsoft.Extensions.Logging.Testing; +using Xunit; +using Xunit.Abstractions; + +namespace FunctionalTests +{ + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class ViewCompilationOptions_Desktop : + LoggedTest, IClassFixture> + { + public ViewCompilationOptions_Desktop( + DesktopApplicationTestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task Precompilation_PreventsRefAssembliesFromBeingPublished() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + Assert.False(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs"))); + } + } + + [ConditionalFact] + public async Task Precompilation_PublishesPdbsToOutputDirectory() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + var pdbPath = Path.Combine(deployment.ContentRoot, Fixture.ApplicationName + ".PrecompiledViews.pdb"); + + // Act & Assert + Assert.True(File.Exists(pdbPath), $"PDB at {pdbPath} was not found."); + } + } + } + + [OSSkipCondition(OperatingSystems.Linux)] + [OSSkipCondition(OperatingSystems.MacOSX)] + public class ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished : + LoggedTest, IClassFixture + { + public ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished( + TestFixture fixture, + ITestOutputHelper output) + : base(output) + { + Fixture = fixture; + } + + public ApplicationTestFixture Fixture { get; } + + [ConditionalFact] + public async Task PublishingWithOption_AllowsPublishingRefAssemblies() + { + using (StartLog(out var loggerFactory)) + { + // Arrange + var deployment = await Fixture.CreateDeploymentAsync(loggerFactory); + + // Act & Assert + Assert.True(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs"))); + } + } + + public class TestFixture : DesktopApplicationTestFixture + { + protected override DeploymentParameters GetDeploymentParameters() + { + var deploymentParameters = base.GetDeploymentParameters(); + deploymentParameters.PublishEnvironmentVariables.Add( + new KeyValuePair("MvcRazorExcludeRefAssembliesFromPublish", "false")); + + return deploymentParameters; + } + } + } +} diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/Program.cs b/testapps/ApplicationUsingPrecompiledViewClassLibrary/Program.cs index ea75f8ccab..dffe015a2d 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/Program.cs +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/Program.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; -namespace ApplicationWithTagHelpers +namespace ApplicationUsingPrecompiledViewClassLibrary { public class Program { diff --git a/testapps/ApplicationUsingPrecompiledViewClassLibrary/Startup.cs b/testapps/ApplicationUsingPrecompiledViewClassLibrary/Startup.cs index 85f98e4a67..bab0147e60 100644 --- a/testapps/ApplicationUsingPrecompiledViewClassLibrary/Startup.cs +++ b/testapps/ApplicationUsingPrecompiledViewClassLibrary/Startup.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -namespace ApplicationWithTagHelpers +namespace ApplicationUsingPrecompiledViewClassLibrary { public class Startup { diff --git a/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs b/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs index 0b44851019..e31a1bc672 100644 --- a/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs +++ b/testapps/SimpleAppDesktopOnly/Controllers/HomeController.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Mvc; -namespace SimpleApp.Controllers +namespace SimpleAppDesktopOnly.Controllers { public class HomeController : Controller { diff --git a/testapps/SimpleAppDesktopOnly/Program.cs b/testapps/SimpleAppDesktopOnly/Program.cs index 6ed39c5e32..c080647071 100644 --- a/testapps/SimpleAppDesktopOnly/Program.cs +++ b/testapps/SimpleAppDesktopOnly/Program.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; -namespace SimpleApp +namespace SimpleAppDesktopOnly { public class Program { diff --git a/testapps/SimpleAppDesktopOnly/Startup.cs b/testapps/SimpleAppDesktopOnly/Startup.cs index 461873a890..b372ddc988 100644 --- a/testapps/SimpleAppDesktopOnly/Startup.cs +++ b/testapps/SimpleAppDesktopOnly/Startup.cs @@ -2,7 +2,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -namespace SimpleApp +namespace SimpleAppDesktopOnly { public class Startup { diff --git a/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml b/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml index 4f65b1d219..dd9f1eb90d 100644 --- a/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml +++ b/testapps/SimpleAppDesktopOnly/Views/Shared/_Layout.cshtml @@ -3,7 +3,7 @@ - @ViewData["Title"] - SimpleApp + @ViewData["Title"] - SimpleAppDesktopOnly @@ -26,7 +26,7 @@ - SimpleApp + SimpleAppDesktopOnly diff --git a/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml b/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml index 71413f674c..69c47ee16f 100644 --- a/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml +++ b/testapps/SimpleAppDesktopOnly/Views/_ViewImports.cshtml @@ -1,2 +1,2 @@ -@using SimpleApp +@using SimpleAppDesktopOnly @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers