Fix functional tests to properly dispose of their app deployer.
This commit is contained in:
parent
4a308f1e9d
commit
2dbe4b79c4
|
|
@ -24,15 +24,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task ConsumingClassLibrariesWithPrecompiledViewsWork(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync("Manage/Home", Fixture.Logger);
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync("Manage/Home", Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationConsumingPrecompiledViewsFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,32 +25,35 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public async Task Precompilation_WorksForViewsUsingRelativePath(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||
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
|
||||
Fixture.CreateDeployment(flavor);
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.DeploymentResult.ApplicationBaseUri,
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("ApplicationUsingRelativePaths.Home.About.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationUsingRelativePathsTestFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,26 +25,28 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public async Task Precompilation_RunsConfiguredCompilationCallbacks(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||
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
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/ViewWithPreprocessor",
|
||||
Fixture.Logger);
|
||||
|
||||
|
|
@ -53,6 +55,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
"ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt",
|
||||
response);
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationWithConfigureMvcFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,24 +30,27 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
public async Task ApplicationWithCustomInputFiles_Works(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
var expectedText = "Hello Index!";
|
||||
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.DeploymentResult.ApplicationBaseUri,
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedText, response.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
var expectedViews = new[]
|
||||
{
|
||||
"/Views/Home/About.cshtml",
|
||||
|
|
@ -55,7 +58,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
};
|
||||
|
||||
// Act
|
||||
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/GetPrecompiledResourceNames",
|
||||
Fixture.Logger);
|
||||
|
||||
|
|
@ -64,13 +67,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
|
||||
Assert.Equal(expectedViews, actual);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public void MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled(RuntimeFlavor flavor)
|
||||
public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
var viewsNotPublished = new[]
|
||||
{
|
||||
"Index.cshtml",
|
||||
|
|
@ -81,7 +86,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
{
|
||||
"NotIncluded.cshtml",
|
||||
};
|
||||
var viewsDirectory = Path.Combine(Fixture.DeploymentResult.ContentRoot, "Views", "Home");
|
||||
var viewsDirectory = Path.Combine(deployment.DeploymentResult.ContentRoot, "Views", "Home");
|
||||
|
||||
// Act & Assert
|
||||
foreach (var file in viewsPublished)
|
||||
|
|
@ -96,6 +101,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
Assert.False(File.Exists(filePath), $"{filePath} was published.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationWithCustomInputFilesTestFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,16 +46,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url, RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
$"Home/{url}",
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.{url}.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationWithTagHelpersFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ 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,45 +14,22 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public abstract class ApplicationTestFixture : IDisposable
|
||||
{
|
||||
public const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT";
|
||||
private IApplicationDeployer _deployer;
|
||||
private HttpClient _httpClient;
|
||||
|
||||
protected ApplicationTestFixture(string applicationName)
|
||||
{
|
||||
ApplicationName = applicationName;
|
||||
LoggerFactory = CreateLoggerFactory();
|
||||
Logger = LoggerFactory.CreateLogger($"{ApplicationName}");
|
||||
}
|
||||
|
||||
public string ApplicationName { get; }
|
||||
|
||||
public string ApplicationPath => ApplicationPaths.GetTestAppDirectory(ApplicationName);
|
||||
|
||||
public HttpClient HttpClient
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_httpClient == null)
|
||||
{
|
||||
if (DeploymentResult == null)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(CreateDeployment)} must be called prior to accessing the {nameof(HttpClient)} property.");
|
||||
}
|
||||
|
||||
_httpClient = new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(DeploymentResult.ApplicationBaseUri),
|
||||
};
|
||||
}
|
||||
|
||||
return _httpClient;
|
||||
}
|
||||
}
|
||||
|
||||
public ILogger Logger { get; private set; }
|
||||
|
||||
public ILoggerFactory LoggerFactory { get; private set; }
|
||||
|
||||
public DeploymentResult DeploymentResult { get; private set; }
|
||||
|
||||
public virtual DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor)
|
||||
{
|
||||
return GetDeploymentParameters(ApplicationPath, flavor);
|
||||
|
|
@ -96,8 +74,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
_httpClient?.Dispose();
|
||||
_deployer?.Dispose();
|
||||
}
|
||||
|
||||
private static void TryDeleteDirectory(string directory)
|
||||
|
|
@ -112,14 +88,35 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
}
|
||||
}
|
||||
|
||||
public void CreateDeployment(RuntimeFlavor flavor)
|
||||
public async Task<Deployment> CreateDeploymentAsync(RuntimeFlavor flavor)
|
||||
{
|
||||
LoggerFactory = CreateLoggerFactory();
|
||||
Logger = LoggerFactory.CreateLogger($"{ApplicationName}:{flavor}");
|
||||
|
||||
var deploymentParameters = GetDeploymentParameters(flavor);
|
||||
_deployer = ApplicationDeployerFactory.Create(deploymentParameters, LoggerFactory);
|
||||
DeploymentResult = _deployer.DeployAsync().Result;
|
||||
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;
|
||||
}
|
||||
|
||||
public IApplicationDeployer Deployer { get; }
|
||||
|
||||
public HttpClient HttpClient { get; }
|
||||
|
||||
public DeploymentResult DeploymentResult { get; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Deployer.Dispose();
|
||||
HttpClient.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
public async Task Precompilation_CanEmbedViewSourcesAsResources(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
var expectedViews = new[]
|
||||
{
|
||||
"/Areas/TestArea/Views/Home/Index.cshtml",
|
||||
|
|
@ -40,7 +41,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
var expectedText = "Hello Index!";
|
||||
|
||||
// Act - 1
|
||||
var response1 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response1 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/Index",
|
||||
Fixture.Logger);
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
Assert.Equal(expectedText, response1.Trim());
|
||||
|
||||
// Act - 2
|
||||
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/GetPrecompiledResourceNames",
|
||||
Fixture.Logger);
|
||||
|
||||
|
|
@ -57,6 +58,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
|||
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
|
||||
Assert.Equal(expectedViews, actual);
|
||||
}
|
||||
}
|
||||
|
||||
public class PublishWithEmbedViewSourcesTestFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,97 +24,103 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public async Task Precompilation_WorksForIndexPage_UsingFolderName(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/",
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_WorksForIndexPage_UsingFileName(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/Index",
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_WorksForPageWithModel(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/PageWithModel?person=Dan",
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_WorksForPageWithRoute(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/PageWithRoute/Dan",
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_WorksForPageInNestedFolder(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/Nested1/Nested2/PageWithTagHelper",
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public async Task Precompilation_WorksWithPageConventions(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await RetryHelper.RetryRequest(
|
||||
() => Fixture.HttpClient.GetAsync("/Auth/Index"),
|
||||
() => deployment.HttpClient.GetAsync("/Auth/Index"),
|
||||
Fixture.Logger,
|
||||
retryCount: 5);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery);
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,16 +24,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.DeploymentResult.ApplicationBaseUri,
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class SimpleAppTestFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,16 +24,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.DeploymentResult.ApplicationBaseUri,
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,16 +20,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public async Task Precompilation_WorksForSimpleApps()
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(RuntimeFlavor.Clr);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(RuntimeFlavor.Clr))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.DeploymentResult.ApplicationBaseUri,
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("SimpleAppX86DesktopOnly.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class SimpleAppX86DesktopOnlyFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,16 +24,17 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act
|
||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.DeploymentResult.ApplicationBaseUri,
|
||||
Fixture.Logger);
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("StrongNamedApp.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class StrongNamedAppFixture : ApplicationTestFixture
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,13 +23,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
|||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
||||
public void Precompilation_PreventsRefAssembliesFromBeingPublished(RuntimeFlavor flavor)
|
||||
public async Task Precompilation_PreventsRefAssembliesFromBeingPublished(RuntimeFlavor flavor)
|
||||
{
|
||||
// Arrange
|
||||
Fixture.CreateDeployment(flavor);
|
||||
|
||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
||||
{
|
||||
// Act & Assert
|
||||
Assert.False(Directory.Exists(Path.Combine(Fixture.DeploymentResult.ContentRoot, "refs")));
|
||||
Assert.False(Directory.Exists(Path.Combine(deployment.DeploymentResult.ContentRoot, "refs")));
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
|
|
|
|||
Loading…
Reference in New Issue