From c18724a275a94d27ce325745f87fa6db9524e928 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Fri, 14 Apr 2017 14:46:17 -0700 Subject: [PATCH] Updated to use 0.4.0 version of IntegrationTesting package --- .gitignore | 3 +- build/dependencies.props | 2 +- global.json | 1 + .../ApplicationConsumingPrecompiledViews.cs | 7 +-- .../ApplicationUsingRelativePathsTest.cs | 10 +--- .../ApplicationWithConfigureMvcTest.cs | 10 +--- .../ApplicationWithCustomInputFilesTest.cs | 9 +-- .../ApplicationWithParseErrorsTest.cs | 56 +++++++------------ .../ApplicationWithTagHelpersTest.cs | 5 +- .../Infrastructure/ApplicationTestFixture.cs | 50 ++++++++--------- .../Infrastructure/HttpClientExtensions.cs | 7 +++ ...zor.ViewCompilation.FunctionalTests.csproj | 2 +- .../PublishWithEmbedViewSourcesTest.cs | 7 +-- .../SimpleAppTest.cs | 5 +- .../SimpleAppWithAssemblyRenameTest.cs | 5 +- .../StrongNamedAppTest.cs | 5 +- .../ViewCompilationOptionsTest.cs | 15 ++--- 17 files changed, 77 insertions(+), 122 deletions(-) create mode 100644 global.json diff --git a/.gitignore b/.gitignore index 37e2db660f..5686dc84ef 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ node_modules *launchSettings.json *.orig BuildInfo.generated.cs -msbuild.log \ No newline at end of file +msbuild.log +global.json \ No newline at end of file diff --git a/build/dependencies.props b/build/dependencies.props index 995e1ccfb2..30c11bc1a0 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,7 +1,7 @@ 2.0.0-* - 0.3.0-* + 0.4.0-* 4.3.0 2.0.0-* 1.6.1 diff --git a/global.json b/global.json new file mode 100644 index 0000000000..eb97e72e25 --- /dev/null +++ b/global.json @@ -0,0 +1 @@ +{ "sdk": { "version": "2.0.0-preview1-005783" } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs index 950417b5d3..a2eea9cc53 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationConsumingPrecompiledViews.cs @@ -19,13 +19,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public async Task ConsumingClassLibrariesWithPrecompiledViewsWork() { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act - var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri + "Manage/Home", - Fixture.Logger); + var response = await Fixture.HttpClient.GetStringWithRetryAsync("Manage/Home", Fixture.Logger); // Assert TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response); diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationUsingRelativePathsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationUsingRelativePathsTest.cs index e44441c917..7cf4d81a61 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationUsingRelativePathsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationUsingRelativePathsTest.cs @@ -19,12 +19,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public async Task Precompilation_WorksForViewsUsingRelativePath() { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, + Fixture.DeploymentResult.ApplicationBaseUri, Fixture.Logger); // Assert @@ -34,12 +31,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public async Task Precompilation_WorksForViewsUsingDirectoryTraversal() { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, + Fixture.DeploymentResult.ApplicationBaseUri, Fixture.Logger); // Assert diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs index 724a48f44c..28d9ade4e8 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithConfigureMvcTest.cs @@ -19,12 +19,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public async Task Precompilation_RunsConfiguredCompilationCallbacks() { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, + Fixture.DeploymentResult.ApplicationBaseUri, Fixture.Logger); // Assert @@ -34,12 +31,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public async Task Precompilation_UsesConfiguredParseOptions() { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri + "Home/ViewWithPreprocessor", + "Home/ViewWithPreprocessor", Fixture.Logger); // Assert diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs index 1df28db3e9..a8753e3139 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithCustomInputFilesTest.cs @@ -26,11 +26,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests { // Arrange var expectedText = "Hello Index!"; - var deploymentResult = Fixture.CreateDeployment(); // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, + Fixture.DeploymentResult.ApplicationBaseUri, Fixture.Logger); // Assert @@ -46,11 +45,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests "/Views/Home/About.cshtml", "/Views/Home/Index.cshtml", }; - var deploymentResult = Fixture.CreateDeployment(); // Act var response2 = await Fixture.HttpClient.GetStringWithRetryAsync( - $"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames", + "Home/GetPrecompiledResourceNames", Fixture.Logger); // Assert @@ -73,8 +71,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests { "NotIncluded.cshtml", }; - var deploymentResult = Fixture.CreateDeployment(); - var viewsDirectory = Path.Combine(deploymentResult.ContentRoot, "Views", "Home"); + var viewsDirectory = Path.Combine(Fixture.DeploymentResult.ContentRoot, "Views", "Home"); // Act & Assert foreach (var file in viewsPublished) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithParseErrorsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithParseErrorsTest.cs index 2815e42d19..22b1ea9d5d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithParseErrorsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithParseErrorsTest.cs @@ -4,58 +4,42 @@ using System; using System.IO; using System.Linq; -using Microsoft.Extensions.Logging; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.Extensions.Logging.Testing; using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { - public class ApplicationWithParseErrorsTest : - IClassFixture + public class ApplicationWithParseErrorsTest { - public ApplicationWithParseErrorsTest(ApplicationWithParseErrorsFixture fixture) - { - Fixture = fixture; - } - - public ApplicationWithParseErrorsFixture Fixture { get; } - [Fact] - public void PublishingPrintsParseErrors() + public async Task PublishingPrintsParseErrors() { - var indexPath = Path.Combine(Fixture.ApplicationPath, "Views", "Home", "Index.cshtml"); - var viewImportsPath = Path.Combine(Fixture.ApplicationPath, "Views", "Home", "About.cshtml"); + // 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.", }; - - // Act & Assert - Assert.Throws(() => Fixture.CreateDeployment()); - - // Assert - var output = Fixture.TestSink.Writes.Select(w => w.State.ToString().Trim()).ToList(); - - foreach (var error in expectedErrors) + var testSink = new TestSink(); + var deploymentParameters = ApplicationTestFixture.GetDeploymentParameters(applicationPath); + var loggerFactory = new TestLoggerFactory(testSink, enabled: true); + using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { - Assert.Contains(error, output); - } - } + // Act + await Assert.ThrowsAsync(() => deployer.DeployAsync()); - public class ApplicationWithParseErrorsFixture : ApplicationTestFixture - { - public ApplicationWithParseErrorsFixture() - : base("ApplicationWithParseErrors") - { - } - - public TestSink TestSink { get; } = new TestSink(); - - public override ILogger CreateLogger() - { - return new TestLoggerFactory(TestSink, enabled: true).CreateLogger($"{ApplicationName}"); + // 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/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs index 0c62583ead..bb69df2c17 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ApplicationWithTagHelpersTest.cs @@ -31,12 +31,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [MemberData(nameof(ApplicationWithTagHelpersData))] public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url) { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - $"{deploymentResult.ApplicationBaseUri}Home/{url}", + $"Home/{url}", Fixture.Logger); // Assert diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs index fa265a149c..69ccd33519 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/ApplicationTestFixture.cs @@ -13,51 +13,41 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation public abstract class ApplicationTestFixture : IDisposable { public const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT"; - private readonly object _deploymentLock = new object(); private IApplicationDeployer _deployer; - private DeploymentResult _deploymentResult; protected ApplicationTestFixture(string applicationName) { ApplicationName = applicationName; + DeploymentResult = CreateDeployment(); + HttpClient = new HttpClient(); + HttpClient.BaseAddress = new Uri(DeploymentResult.ApplicationBaseUri); } public string ApplicationName { get; } public string ApplicationPath => ApplicationPaths.GetTestAppDirectory(ApplicationName); - public HttpClient HttpClient { get; } = new HttpClient(); + public HttpClient HttpClient { get; } public ILogger Logger { get; private set; } - public DeploymentResult CreateDeployment() - { - lock (_deploymentLock) - { - if (_deployer != null) - { - return _deploymentResult; - } + public ILoggerFactory LoggerFactory { get; private set; } - Logger = CreateLogger(); - var deploymentParameters = GetDeploymentParameters(); - var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Logger); - _deploymentResult = deployer.Deploy(); - - _deployer = deployer; - - return _deploymentResult; - } - } + public DeploymentResult DeploymentResult { get; private set; } public virtual DeploymentParameters GetDeploymentParameters() + { + return GetDeploymentParameters(ApplicationPath); + } + + public static DeploymentParameters GetDeploymentParameters(string applicationPath) { var telemetryOptOut = new KeyValuePair( DotnetCLITelemetryOptOut, "1"); var deploymentParameters = new DeploymentParameters( - ApplicationPath, + applicationPath, ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64) @@ -82,11 +72,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation return deploymentParameters; } - public virtual ILogger CreateLogger() + public virtual ILoggerFactory CreateLoggerFactory() { - return new LoggerFactory() - .AddConsole() - .CreateLogger($"{ApplicationName}"); + return new LoggerFactory().AddConsole(); } public void Dispose() @@ -106,5 +94,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation // Ignore delete failures. } } + + private DeploymentResult CreateDeployment() + { + LoggerFactory = CreateLoggerFactory(); + Logger = LoggerFactory.CreateLogger(ApplicationName); + + var deploymentParameters = GetDeploymentParameters(); + _deployer = ApplicationDeployerFactory.Create(deploymentParameters, LoggerFactory); + return _deployer.DeployAsync().Result; + } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs index a110fd3973..bbdb2b6af2 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Infrastructure/HttpClientExtensions.cs @@ -12,6 +12,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation { public static class HttpClientExtensions { + public static Task GetStringWithRetryAsync( + this HttpClient httpClient, + ILogger logger) + { + return GetStringWithRetryAsync(httpClient, httpClient.BaseAddress.AbsoluteUri, logger); + } + public static async Task GetStringWithRetryAsync( this HttpClient httpClient, string url, diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj index 5f190c7c5c..cacf21dda9 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests.csproj @@ -12,7 +12,7 @@ - + diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs index fe67e042c4..3d7566dce7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs @@ -32,15 +32,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests "/Views/Home/Index.cshtml", }; var expectedText = "Hello Index!"; - var deploymentResult = Fixture.CreateDeployment(); var assemblyPath = Path.Combine( - deploymentResult.DeploymentParameters.PublishedApplicationRootPath, + Fixture.DeploymentResult.DeploymentParameters.PublishedApplicationRootPath, $"{ApplicationName}.PrecompiledViews.dll"); // Act - 1 var response1 = await Fixture.HttpClient.GetStringWithRetryAsync( - $"{deploymentResult.ApplicationBaseUri}Home/Index", + "Home/Index", Fixture.Logger); // Assert - 1 @@ -48,7 +47,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests // Act - 2 var response2 = await Fixture.HttpClient.GetStringWithRetryAsync( - $"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames", + "Home/GetPrecompiledResourceNames", Fixture.Logger); // Assert - 2 diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs index 6149d37d7a..bc5b1e9894 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppTest.cs @@ -18,12 +18,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public async Task Precompilation_WorksForSimpleApps() { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, + Fixture.DeploymentResult.ApplicationBaseUri, Fixture.Logger); // Assert diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppWithAssemblyRenameTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppWithAssemblyRenameTest.cs index daf2f805c5..bf425a078f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppWithAssemblyRenameTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/SimpleAppWithAssemblyRenameTest.cs @@ -19,12 +19,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public async Task Precompilation_WorksForSimpleApps() { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, + Fixture.DeploymentResult.ApplicationBaseUri, Fixture.Logger); // Assert diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs index 9f87dd327e..b1b63329a5 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/StrongNamedAppTest.cs @@ -18,12 +18,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public async Task PrecompiledAssembliesUseSameStrongNameAsApplication() { - // Arrange - var deploymentResult = Fixture.CreateDeployment(); - // Act var response = await Fixture.HttpClient.GetStringWithRetryAsync( - deploymentResult.ApplicationBaseUri, + Fixture.DeploymentResult.ApplicationBaseUri, Fixture.Logger); // Assert diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ViewCompilationOptionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ViewCompilationOptionsTest.cs index c96eaea4e0..7f610020f5 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ViewCompilationOptionsTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/ViewCompilationOptionsTest.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; +using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; @@ -20,26 +21,22 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation [Fact] public void Precompilation_PreventsRefAssembliesFromBeingPublished() { - // Arrange & Act - var deploymentResult = Fixture.CreateDeployment(); - - // Assert - Assert.False(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs"))); + // Act & Assert + Assert.False(Directory.Exists(Path.Combine(Fixture.DeploymentResult.ContentRoot, "refs"))); } [Fact] - public void PublishingWithOption_AllowsPublishingRefAssemblies() + public async Task PublishingWithOption_AllowsPublishingRefAssemblies() { // Arrange var deploymentParameters = Fixture.GetDeploymentParameters(); deploymentParameters.PublishEnvironmentVariables.Add( new KeyValuePair("MvcRazorExcludeRefAssembliesFromPublish", "false")); - var logger = Fixture.CreateLogger(); - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) + using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Fixture.LoggerFactory)) { // Act - var deploymentResult = deployer.Deploy(); + var deploymentResult = await deployer.DeployAsync(); // Assert Assert.True(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));