Updated to use 0.4.0 version of IntegrationTesting package
This commit is contained in:
parent
cc1b5f4d5b
commit
c18724a275
|
|
@ -38,4 +38,5 @@ node_modules
|
||||||
*launchSettings.json
|
*launchSettings.json
|
||||||
*.orig
|
*.orig
|
||||||
BuildInfo.generated.cs
|
BuildInfo.generated.cs
|
||||||
msbuild.log
|
msbuild.log
|
||||||
|
global.json
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
|
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
|
||||||
<AspNetCoreLabsVersion>0.3.0-*</AspNetCoreLabsVersion>
|
<AspNetCoreIntegrationTestingVersion>0.4.0-*</AspNetCoreIntegrationTestingVersion>
|
||||||
<CoreFxVersion>4.3.0</CoreFxVersion>
|
<CoreFxVersion>4.3.0</CoreFxVersion>
|
||||||
<InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion>
|
<InternalAspNetCoreSdkVersion>2.0.0-*</InternalAspNetCoreSdkVersion>
|
||||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{ "sdk": { "version": "2.0.0-preview1-005783" } }
|
||||||
|
|
@ -19,13 +19,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task ConsumingClassLibrariesWithPrecompiledViewsWork()
|
public async Task ConsumingClassLibrariesWithPrecompiledViewsWork()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync("Manage/Home", Fixture.Logger);
|
||||||
deploymentResult.ApplicationBaseUri + "Manage/Home",
|
|
||||||
Fixture.Logger);
|
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response);
|
TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response);
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Precompilation_WorksForViewsUsingRelativePath()
|
public async Task Precompilation_WorksForViewsUsingRelativePath()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
deploymentResult.ApplicationBaseUri,
|
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -34,12 +31,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal()
|
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
deploymentResult.ApplicationBaseUri,
|
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Precompilation_RunsConfiguredCompilationCallbacks()
|
public async Task Precompilation_RunsConfiguredCompilationCallbacks()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
deploymentResult.ApplicationBaseUri,
|
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -34,12 +31,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Precompilation_UsesConfiguredParseOptions()
|
public async Task Precompilation_UsesConfiguredParseOptions()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
deploymentResult.ApplicationBaseUri + "Home/ViewWithPreprocessor",
|
"Home/ViewWithPreprocessor",
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var expectedText = "Hello Index!";
|
var expectedText = "Hello Index!";
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
deploymentResult.ApplicationBaseUri,
|
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -46,11 +45,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
||||||
"/Views/Home/About.cshtml",
|
"/Views/Home/About.cshtml",
|
||||||
"/Views/Home/Index.cshtml",
|
"/Views/Home/Index.cshtml",
|
||||||
};
|
};
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
$"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames",
|
"Home/GetPrecompiledResourceNames",
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -73,8 +71,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
||||||
{
|
{
|
||||||
"NotIncluded.cshtml",
|
"NotIncluded.cshtml",
|
||||||
};
|
};
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
var viewsDirectory = Path.Combine(Fixture.DeploymentResult.ContentRoot, "Views", "Home");
|
||||||
var viewsDirectory = Path.Combine(deploymentResult.ContentRoot, "Views", "Home");
|
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
foreach (var file in viewsPublished)
|
foreach (var file in viewsPublished)
|
||||||
|
|
|
||||||
|
|
@ -4,58 +4,42 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Extensions.Logging;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.Extensions.Logging.Testing;
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
{
|
{
|
||||||
public class ApplicationWithParseErrorsTest :
|
public class ApplicationWithParseErrorsTest
|
||||||
IClassFixture<ApplicationWithParseErrorsTest.ApplicationWithParseErrorsFixture>
|
|
||||||
{
|
{
|
||||||
public ApplicationWithParseErrorsTest(ApplicationWithParseErrorsFixture fixture)
|
|
||||||
{
|
|
||||||
Fixture = fixture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ApplicationWithParseErrorsFixture Fixture { get; }
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void PublishingPrintsParseErrors()
|
public async Task PublishingPrintsParseErrors()
|
||||||
{
|
{
|
||||||
var indexPath = Path.Combine(Fixture.ApplicationPath, "Views", "Home", "Index.cshtml");
|
// Arrange
|
||||||
var viewImportsPath = Path.Combine(Fixture.ApplicationPath, "Views", "Home", "About.cshtml");
|
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[]
|
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.",
|
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.",
|
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();
|
||||||
// Act & Assert
|
var deploymentParameters = ApplicationTestFixture.GetDeploymentParameters(applicationPath);
|
||||||
Assert.Throws<Exception>(() => Fixture.CreateDeployment());
|
var loggerFactory = new TestLoggerFactory(testSink, enabled: true);
|
||||||
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
||||||
// Assert
|
|
||||||
var output = Fixture.TestSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
|
|
||||||
|
|
||||||
foreach (var error in expectedErrors)
|
|
||||||
{
|
{
|
||||||
Assert.Contains(error, output);
|
// Act
|
||||||
}
|
await Assert.ThrowsAsync<Exception>(() => deployer.DeployAsync());
|
||||||
}
|
|
||||||
|
|
||||||
public class ApplicationWithParseErrorsFixture : ApplicationTestFixture
|
// Assert
|
||||||
{
|
var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
|
||||||
public ApplicationWithParseErrorsFixture()
|
foreach (var expectedError in expectedErrors)
|
||||||
: base("ApplicationWithParseErrors")
|
{
|
||||||
{
|
Assert.Contains(logs, log => log.Contains(expectedError));
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestSink TestSink { get; } = new TestSink();
|
|
||||||
|
|
||||||
public override ILogger CreateLogger()
|
|
||||||
{
|
|
||||||
return new TestLoggerFactory(TestSink, enabled: true).CreateLogger($"{ApplicationName}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[MemberData(nameof(ApplicationWithTagHelpersData))]
|
[MemberData(nameof(ApplicationWithTagHelpersData))]
|
||||||
public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url)
|
public async Task Precompilation_WorksForViewsThatUseTagHelpers(string url)
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
$"{deploymentResult.ApplicationBaseUri}Home/{url}",
|
$"Home/{url}",
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
|
||||||
|
|
@ -13,51 +13,41 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
public abstract class ApplicationTestFixture : IDisposable
|
public abstract class ApplicationTestFixture : IDisposable
|
||||||
{
|
{
|
||||||
public const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT";
|
public const string DotnetCLITelemetryOptOut = "DOTNET_CLI_TELEMETRY_OPTOUT";
|
||||||
private readonly object _deploymentLock = new object();
|
|
||||||
private IApplicationDeployer _deployer;
|
private IApplicationDeployer _deployer;
|
||||||
private DeploymentResult _deploymentResult;
|
|
||||||
|
|
||||||
protected ApplicationTestFixture(string applicationName)
|
protected ApplicationTestFixture(string applicationName)
|
||||||
{
|
{
|
||||||
ApplicationName = applicationName;
|
ApplicationName = applicationName;
|
||||||
|
DeploymentResult = CreateDeployment();
|
||||||
|
HttpClient = new HttpClient();
|
||||||
|
HttpClient.BaseAddress = new Uri(DeploymentResult.ApplicationBaseUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ApplicationName { get; }
|
public string ApplicationName { get; }
|
||||||
|
|
||||||
public string ApplicationPath => ApplicationPaths.GetTestAppDirectory(ApplicationName);
|
public string ApplicationPath => ApplicationPaths.GetTestAppDirectory(ApplicationName);
|
||||||
|
|
||||||
public HttpClient HttpClient { get; } = new HttpClient();
|
public HttpClient HttpClient { get; }
|
||||||
|
|
||||||
public ILogger Logger { get; private set; }
|
public ILogger Logger { get; private set; }
|
||||||
|
|
||||||
public DeploymentResult CreateDeployment()
|
public ILoggerFactory LoggerFactory { get; private set; }
|
||||||
{
|
|
||||||
lock (_deploymentLock)
|
|
||||||
{
|
|
||||||
if (_deployer != null)
|
|
||||||
{
|
|
||||||
return _deploymentResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger = CreateLogger();
|
public DeploymentResult DeploymentResult { get; private set; }
|
||||||
var deploymentParameters = GetDeploymentParameters();
|
|
||||||
var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Logger);
|
|
||||||
_deploymentResult = deployer.Deploy();
|
|
||||||
|
|
||||||
_deployer = deployer;
|
|
||||||
|
|
||||||
return _deploymentResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual DeploymentParameters GetDeploymentParameters()
|
public virtual DeploymentParameters GetDeploymentParameters()
|
||||||
|
{
|
||||||
|
return GetDeploymentParameters(ApplicationPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DeploymentParameters GetDeploymentParameters(string applicationPath)
|
||||||
{
|
{
|
||||||
var telemetryOptOut = new KeyValuePair<string, string>(
|
var telemetryOptOut = new KeyValuePair<string, string>(
|
||||||
DotnetCLITelemetryOptOut,
|
DotnetCLITelemetryOptOut,
|
||||||
"1");
|
"1");
|
||||||
|
|
||||||
var deploymentParameters = new DeploymentParameters(
|
var deploymentParameters = new DeploymentParameters(
|
||||||
ApplicationPath,
|
applicationPath,
|
||||||
ServerType.Kestrel,
|
ServerType.Kestrel,
|
||||||
RuntimeFlavor.CoreClr,
|
RuntimeFlavor.CoreClr,
|
||||||
RuntimeArchitecture.x64)
|
RuntimeArchitecture.x64)
|
||||||
|
|
@ -82,11 +72,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
return deploymentParameters;
|
return deploymentParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ILogger CreateLogger()
|
public virtual ILoggerFactory CreateLoggerFactory()
|
||||||
{
|
{
|
||||||
return new LoggerFactory()
|
return new LoggerFactory().AddConsole();
|
||||||
.AddConsole()
|
|
||||||
.CreateLogger($"{ApplicationName}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
@ -106,5 +94,15 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
// Ignore delete failures.
|
// Ignore delete failures.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DeploymentResult CreateDeployment()
|
||||||
|
{
|
||||||
|
LoggerFactory = CreateLoggerFactory();
|
||||||
|
Logger = LoggerFactory.CreateLogger(ApplicationName);
|
||||||
|
|
||||||
|
var deploymentParameters = GetDeploymentParameters();
|
||||||
|
_deployer = ApplicationDeployerFactory.Create(deploymentParameters, LoggerFactory);
|
||||||
|
return _deployer.DeployAsync().Result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
{
|
{
|
||||||
public static class HttpClientExtensions
|
public static class HttpClientExtensions
|
||||||
{
|
{
|
||||||
|
public static Task<string> GetStringWithRetryAsync(
|
||||||
|
this HttpClient httpClient,
|
||||||
|
ILogger logger)
|
||||||
|
{
|
||||||
|
return GetStringWithRetryAsync(httpClient, httpClient.BaseAddress.AbsoluteUri, logger);
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task<string> GetStringWithRetryAsync(
|
public static async Task<string> GetStringWithRetryAsync(
|
||||||
this HttpClient httpClient,
|
this HttpClient httpClient,
|
||||||
string url,
|
string url,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(AspNetCoreLabsVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(AspNetCoreIntegrationTestingVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(AspNetCoreVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(AspNetCoreVersion)" />
|
||||||
|
|
|
||||||
|
|
@ -32,15 +32,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
||||||
"/Views/Home/Index.cshtml",
|
"/Views/Home/Index.cshtml",
|
||||||
};
|
};
|
||||||
var expectedText = "Hello Index!";
|
var expectedText = "Hello Index!";
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
var assemblyPath = Path.Combine(
|
var assemblyPath = Path.Combine(
|
||||||
deploymentResult.DeploymentParameters.PublishedApplicationRootPath,
|
Fixture.DeploymentResult.DeploymentParameters.PublishedApplicationRootPath,
|
||||||
$"{ApplicationName}.PrecompiledViews.dll");
|
$"{ApplicationName}.PrecompiledViews.dll");
|
||||||
|
|
||||||
// Act - 1
|
// Act - 1
|
||||||
var response1 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response1 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
$"{deploymentResult.ApplicationBaseUri}Home/Index",
|
"Home/Index",
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert - 1
|
// Assert - 1
|
||||||
|
|
@ -48,7 +47,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests
|
||||||
|
|
||||||
// Act - 2
|
// Act - 2
|
||||||
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response2 = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
$"{deploymentResult.ApplicationBaseUri}Home/GetPrecompiledResourceNames",
|
"Home/GetPrecompiledResourceNames",
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert - 2
|
// Assert - 2
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Precompilation_WorksForSimpleApps()
|
public async Task Precompilation_WorksForSimpleApps()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
deploymentResult.ApplicationBaseUri,
|
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Precompilation_WorksForSimpleApps()
|
public async Task Precompilation_WorksForSimpleApps()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
deploymentResult.ApplicationBaseUri,
|
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication()
|
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
var response = await Fixture.HttpClient.GetStringWithRetryAsync(
|
||||||
deploymentResult.ApplicationBaseUri,
|
Fixture.DeploymentResult.ApplicationBaseUri,
|
||||||
Fixture.Logger);
|
Fixture.Logger);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -20,26 +21,22 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Precompilation_PreventsRefAssembliesFromBeingPublished()
|
public void Precompilation_PreventsRefAssembliesFromBeingPublished()
|
||||||
{
|
{
|
||||||
// Arrange & Act
|
// Act & Assert
|
||||||
var deploymentResult = Fixture.CreateDeployment();
|
Assert.False(Directory.Exists(Path.Combine(Fixture.DeploymentResult.ContentRoot, "refs")));
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.False(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void PublishingWithOption_AllowsPublishingRefAssemblies()
|
public async Task PublishingWithOption_AllowsPublishingRefAssemblies()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var deploymentParameters = Fixture.GetDeploymentParameters();
|
var deploymentParameters = Fixture.GetDeploymentParameters();
|
||||||
deploymentParameters.PublishEnvironmentVariables.Add(
|
deploymentParameters.PublishEnvironmentVariables.Add(
|
||||||
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
|
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
|
||||||
var logger = Fixture.CreateLogger();
|
|
||||||
|
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
|
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, Fixture.LoggerFactory))
|
||||||
{
|
{
|
||||||
// Act
|
// Act
|
||||||
var deploymentResult = deployer.Deploy();
|
var deploymentResult = await deployer.DeployAsync();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.True(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
|
Assert.True(Directory.Exists(Path.Combine(deploymentResult.ContentRoot, "refs")));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue