Cleanup tests to perform fewer deployments (#154)
* Cleanup tests to perform fewer deployments
This commit is contained in:
parent
8d095d3af6
commit
cd91ab986c
|
|
@ -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<ApplicationConsumingPrecompiledViews.ApplicationConsumingPrecompiledViewsFixture>
|
|
||||||
{
|
|
||||||
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")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<ApplicationUsingPrecompiledViewClassLibrary.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationConsumingPrecompiledViews_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<ApplicationUsingPrecompiledViewClassLibrary.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DesktopApplicationTestFixture<ApplicationUsingPrecompiledViewClassLibrary.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationConsumingPrecompiledViews_Desktop(
|
||||||
|
DesktopApplicationTestFixture<ApplicationUsingPrecompiledViewClassLibrary.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<ApplicationUsingRelativePathsTest.ApplicationUsingRelativePathsTestFixture>
|
|
||||||
{
|
|
||||||
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")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<ApplicationUsingRelativePaths.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationUsingRelativePathsTest_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<ApplicationUsingRelativePaths.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DesktopApplicationTestFixture<ApplicationUsingRelativePaths.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationUsingRelativePathsTest_Desktop(
|
||||||
|
DesktopApplicationTestFixture<ApplicationUsingRelativePaths.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<ApplicationWithConfigureMvcTest.ApplicationWithConfigureMvcFixture>
|
|
||||||
{
|
|
||||||
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")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<ApplicationWithConfigureStartup.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationWithConfigureMvcTest_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<ApplicationWithConfigureStartup.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DesktopApplicationTestFixture<ApplicationWithConfigureStartup.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationWithConfigureMvcTest_Desktop(
|
||||||
|
DesktopApplicationTestFixture<ApplicationWithConfigureStartup.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<ApplicationWithCustomInputFiles.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationWithCustomInputFilesTest_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<ApplicationWithCustomInputFiles.Startup> 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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,62 +5,64 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace FunctionalTests
|
namespace FunctionalTests
|
||||||
{
|
{
|
||||||
public class ApplicationWithCustomInputFilesTest
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
: IClassFixture<ApplicationWithCustomInputFilesTest.ApplicationWithCustomInputFilesTestFixture>
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
|
public class ApplicationWithCustomInputFilesTest_Desktop
|
||||||
|
: LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationWithCustomInputFiles.Startup>>
|
||||||
{
|
{
|
||||||
private const string ApplicationName = "ApplicationWithCustomInputFiles";
|
public ApplicationWithCustomInputFilesTest_Desktop(
|
||||||
|
DesktopApplicationTestFixture<ApplicationWithCustomInputFiles.Startup> fixture,
|
||||||
public ApplicationWithCustomInputFilesTest(ApplicationWithCustomInputFilesTestFixture fixture)
|
ITestOutputHelper output)
|
||||||
|
: base(output)
|
||||||
{
|
{
|
||||||
Fixture = fixture;
|
Fixture = fixture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationTestFixture Fixture { get; }
|
public ApplicationTestFixture Fixture { get; }
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
[ConditionalFact]
|
||||||
|
public async Task ApplicationWithCustomInputFiles_Works()
|
||||||
[ConditionalTheory]
|
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
|
||||||
public async Task ApplicationWithCustomInputFiles_Works(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
var expectedText = "Hello Index!";
|
var expectedText = "Hello Index!";
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
deployment.DeploymentResult.ApplicationBaseUri,
|
deployment.ApplicationBaseUri,
|
||||||
Fixture.Logger);
|
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expectedText, response.Trim());
|
Assert.Equal(expectedText, response.Trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalFact]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled()
|
||||||
public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
var expectedViews = new[]
|
var expectedViews = new[]
|
||||||
{
|
{
|
||||||
"/Views/Home/About.cshtml",
|
"/Views/Home/About.cshtml",
|
||||||
"/Views/Home/Index.cshtml",
|
"/Views/Home/Index.cshtml",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
"Home/GetPrecompiledResourceNames",
|
"Home/GetPrecompiledResourceNames",
|
||||||
Fixture.Logger);
|
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
|
@ -69,13 +71,13 @@ namespace FunctionalTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalFact]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled()
|
||||||
public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
var viewsNotPublished = new[]
|
var viewsNotPublished = new[]
|
||||||
{
|
{
|
||||||
"Index.cshtml",
|
"Index.cshtml",
|
||||||
|
|
@ -86,7 +88,7 @@ namespace FunctionalTests
|
||||||
{
|
{
|
||||||
"NotIncluded.cshtml",
|
"NotIncluded.cshtml",
|
||||||
};
|
};
|
||||||
var viewsDirectory = Path.Combine(deployment.DeploymentResult.ContentRoot, "Views", "Home");
|
var viewsDirectory = Path.Combine(deployment.ContentRoot, "Views", "Home");
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
foreach (var file in viewsPublished)
|
foreach (var file in viewsPublished)
|
||||||
|
|
@ -102,13 +104,5 @@ namespace FunctionalTests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ApplicationWithCustomInputFilesTestFixture : ApplicationTestFixture
|
|
||||||
{
|
|
||||||
public ApplicationWithCustomInputFilesTestFixture()
|
|
||||||
: base(ApplicationWithCustomInputFilesTest.ApplicationName)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<ApplicationWithParseErrors.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationWithParseErrorsTest_CoreCLR(CoreCLRApplicationTestFixture<ApplicationWithParseErrors.Startup> 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<Exception>(() => 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,20 +5,26 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
using Microsoft.Extensions.Logging.Testing;
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace FunctionalTests
|
namespace FunctionalTests
|
||||||
{
|
{
|
||||||
public class ApplicationWithParseErrorsTest
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
|
public class ApplicationWithParseErrorsTest_Desktop
|
||||||
|
: IClassFixture<DesktopApplicationTestFixture<ApplicationWithParseErrors.Startup>>
|
||||||
{
|
{
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
public ApplicationWithParseErrorsTest_Desktop(DesktopApplicationTestFixture<ApplicationWithParseErrors.Startup> fixture)
|
||||||
|
{
|
||||||
|
Fixture = fixture;
|
||||||
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
public ApplicationTestFixture Fixture { get; }
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
|
||||||
public async Task PublishingPrintsParseErrors(RuntimeFlavor flavor)
|
[ConditionalFact]
|
||||||
|
public async Task PublishingPrintsParseErrors()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var applicationPath = ApplicationPaths.GetTestAppDirectory("ApplicationWithParseErrors");
|
var applicationPath = ApplicationPaths.GetTestAppDirectory("ApplicationWithParseErrors");
|
||||||
|
|
@ -31,19 +37,16 @@ namespace FunctionalTests
|
||||||
|
|
||||||
};
|
};
|
||||||
var testSink = new TestSink();
|
var testSink = new TestSink();
|
||||||
var deploymentParameters = ApplicationTestFixture.GetDeploymentParameters(applicationPath, flavor);
|
|
||||||
var loggerFactory = new TestLoggerFactory(testSink, enabled: true);
|
var loggerFactory = new TestLoggerFactory(testSink, enabled: true);
|
||||||
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
|
|
||||||
{
|
|
||||||
// Act
|
|
||||||
await Assert.ThrowsAsync<Exception>(() => deployer.DeployAsync());
|
|
||||||
|
|
||||||
// Assert
|
// Act
|
||||||
var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
|
await Assert.ThrowsAsync<Exception>(() => Fixture.CreateDeploymentAsync(loggerFactory));
|
||||||
foreach (var expectedError in expectedErrors)
|
|
||||||
{
|
// Assert
|
||||||
Assert.Contains(logs, log => log.Contains(expectedError));
|
var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
|
||||||
}
|
foreach (var expectedError in expectedErrors)
|
||||||
|
{
|
||||||
|
Assert.Contains(logs, log => log.Contains(expectedError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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<TagHelperTest.ApplicationWithTagHelpersFixture>
|
|
||||||
{
|
|
||||||
public TagHelperTest(ApplicationWithTagHelpersFixture fixture)
|
|
||||||
{
|
|
||||||
Fixture = fixture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ApplicationTestFixture Fixture { get; }
|
|
||||||
|
|
||||||
public static TheoryData ApplicationWithTagHelpersData
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var urls = new[]
|
|
||||||
{
|
|
||||||
"ClassLibraryTagHelper",
|
|
||||||
"LocalTagHelper",
|
|
||||||
};
|
|
||||||
|
|
||||||
var data = new TheoryData<string, RuntimeFlavor>();
|
|
||||||
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")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<ApplicationWithTagHelpers.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationWithTagHelpersTest_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<ApplicationWithTagHelpers.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DesktopApplicationTestFixture<ApplicationWithTagHelpers.Startup>>
|
||||||
|
{
|
||||||
|
public ApplicationWithTagHelpersTest_Desktop(
|
||||||
|
DesktopApplicationTestFixture<ApplicationWithTagHelpers.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<DefineConstants>$(DefineConstants);__remove_this_to__GENERATE_BASELINES</DefineConstants>
|
<DefineConstants>$(DefineConstants);__remove_this_to__GENERATE_BASELINES</DefineConstants>
|
||||||
<DefineConstants Condition="'$(GenerateBaseLines)'=='true'">$(DefineConstants);GENERATE_BASELINES</DefineConstants>
|
<DefineConstants Condition="'$(GenerateBaseLines)'=='true'">$(DefineConstants);GENERATE_BASELINES</DefineConstants>
|
||||||
|
<SignAssembly>false</SignAssembly>
|
||||||
|
<PublicSign>false</PublicSign>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -23,4 +25,18 @@
|
||||||
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\testapps\ApplicationUsingPrecompiledViewClassLibrary\ApplicationUsingPrecompiledViewClassLibrary.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\ApplicationUsingRelativePaths\ApplicationUsingRelativePaths.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\ApplicationWithConfigureMvc\ApplicationWithConfigureMvc.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\ApplicationWithCustomInputFiles\ApplicationWithCustomInputFiles.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\ApplicationWithParseErrors\ApplicationWithParseErrors.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\ApplicationWithTagHelpers\ApplicationWithTagHelpers.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\PublishWithEmbedViewSources\PublishWithEmbedViewSources.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\RazorPagesApp\RazorPagesApp.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\SimpleAppWithAssemblyRename\SimpleAppWithAssemblyRename.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\SimpleApp\SimpleApp.csproj" />
|
||||||
|
<ProjectReference Include="..\..\testapps\StrongNamedApp\StrongNamedApp.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
@ -13,40 +11,36 @@ namespace FunctionalTests
|
||||||
{
|
{
|
||||||
public abstract class ApplicationTestFixture : IDisposable
|
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<DeploymentResult> _deploymentTask;
|
||||||
|
private IApplicationDeployer _deployer;
|
||||||
|
|
||||||
protected ApplicationTestFixture(string applicationName)
|
protected ApplicationTestFixture(string applicationName, string applicationPath)
|
||||||
{
|
{
|
||||||
ApplicationName = applicationName;
|
ApplicationName = applicationName;
|
||||||
LoggerFactory = CreateLoggerFactory();
|
ApplicationPath = applicationPath ?? ApplicationPaths.GetTestAppDirectory(applicationName);
|
||||||
Logger = LoggerFactory.CreateLogger($"{ApplicationName}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ApplicationName { get; }
|
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; }
|
protected DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor)
|
||||||
|
|
||||||
public virtual DeploymentParameters GetDeploymentParameters(RuntimeFlavor flavor)
|
|
||||||
{
|
|
||||||
return GetDeploymentParameters(ApplicationPath, flavor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DeploymentParameters GetDeploymentParameters(string applicationPath, RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
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,
|
||||||
flavor,
|
flavor,
|
||||||
RuntimeArchitecture.x64)
|
RuntimeArchitecture.x64)
|
||||||
{
|
{
|
||||||
|
ApplicationName = ApplicationName,
|
||||||
PublishApplicationBeforeDeployment = true,
|
PublishApplicationBeforeDeployment = true,
|
||||||
TargetFramework = flavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
|
TargetFramework = flavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
@ -67,56 +61,29 @@ namespace FunctionalTests
|
||||||
return deploymentParameters;
|
return deploymentParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual ILoggerFactory CreateLoggerFactory()
|
|
||||||
{
|
|
||||||
return new LoggerFactory().AddConsole();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
if (_deploymentTask?.Status == TaskStatus.RanToCompletion)
|
||||||
|
{
|
||||||
|
_deploymentTask.Result.HttpClient?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
_deployer?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void TryDeleteDirectory(string directory)
|
public async Task<DeploymentResult> CreateDeploymentAsync(ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
try
|
lock (_deploymentLock)
|
||||||
{
|
{
|
||||||
Directory.Delete(directory, recursive: true);
|
if (_deploymentTask == null)
|
||||||
}
|
{
|
||||||
catch (IOException)
|
var deploymentParameters = GetDeploymentParameters();
|
||||||
{
|
_deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory);
|
||||||
// Ignore delete failures.
|
_deploymentTask = _deployer.DeployAsync();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Deployment> 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IApplicationDeployer Deployer { get; }
|
return await _deploymentTask;
|
||||||
|
|
||||||
public HttpClient HttpClient { get; }
|
|
||||||
|
|
||||||
public DeploymentResult DeploymentResult { get; }
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Deployer.Dispose();
|
|
||||||
HttpClient.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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<TStartup> : 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<TStartup> : 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<PublishWithEmbedViewSources.Startup>>
|
||||||
|
{
|
||||||
|
public PublishWithEmbedViewSourcesTest_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<PublishWithEmbedViewSources.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,36 +2,38 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.AspNetCore.Testing.xunit;
|
||||||
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace FunctionalTests
|
namespace FunctionalTests
|
||||||
{
|
{
|
||||||
public class PublishWithEmbedViewSourcesTest
|
[OSSkipCondition(OperatingSystems.Linux)]
|
||||||
: IClassFixture<PublishWithEmbedViewSourcesTest.PublishWithEmbedViewSourcesTestFixture>
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||||
|
public class PublishWithEmbedViewSourcesTest_Desktop
|
||||||
|
: LoggedTest, IClassFixture<DesktopApplicationTestFixture<PublishWithEmbedViewSources.Startup>>
|
||||||
{
|
{
|
||||||
private const string ApplicationName = "PublishWithEmbedViewSources";
|
public PublishWithEmbedViewSourcesTest_Desktop(
|
||||||
|
DesktopApplicationTestFixture<PublishWithEmbedViewSources.Startup> fixture,
|
||||||
public PublishWithEmbedViewSourcesTest(PublishWithEmbedViewSourcesTestFixture fixture)
|
ITestOutputHelper output)
|
||||||
|
: base(output)
|
||||||
{
|
{
|
||||||
Fixture = fixture;
|
Fixture = fixture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationTestFixture Fixture { get; }
|
public ApplicationTestFixture Fixture { get; }
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
[ConditionalFact]
|
||||||
|
public async Task Precompilation_CanEmbedViewSourcesAsResources()
|
||||||
[ConditionalTheory]
|
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
|
||||||
public async Task Precompilation_CanEmbedViewSourcesAsResources(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
|
var logger = loggerFactory.CreateLogger(Fixture.ApplicationName);
|
||||||
var expectedViews = new[]
|
var expectedViews = new[]
|
||||||
{
|
{
|
||||||
"/Areas/TestArea/Views/Home/Index.cshtml",
|
"/Areas/TestArea/Views/Home/Index.cshtml",
|
||||||
|
|
@ -43,7 +45,7 @@ namespace FunctionalTests
|
||||||
// Act - 1
|
// Act - 1
|
||||||
var response1 = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response1 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
"Home/Index",
|
"Home/Index",
|
||||||
Fixture.Logger);
|
logger);
|
||||||
|
|
||||||
// Assert - 1
|
// Assert - 1
|
||||||
Assert.Equal(expectedText, response1.Trim());
|
Assert.Equal(expectedText, response1.Trim());
|
||||||
|
|
@ -51,7 +53,7 @@ namespace FunctionalTests
|
||||||
// Act - 2
|
// Act - 2
|
||||||
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
"Home/GetPrecompiledResourceNames",
|
"Home/GetPrecompiledResourceNames",
|
||||||
Fixture.Logger);
|
logger);
|
||||||
|
|
||||||
// Assert - 2
|
// Assert - 2
|
||||||
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
|
|
@ -59,13 +61,5 @@ namespace FunctionalTests
|
||||||
Assert.Equal(expectedViews, actual);
|
Assert.Equal(expectedViews, actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PublishWithEmbedViewSourcesTestFixture : ApplicationTestFixture
|
|
||||||
{
|
|
||||||
public PublishWithEmbedViewSourcesTestFixture()
|
|
||||||
: base(PublishWithEmbedViewSourcesTest.ApplicationName)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,131 +3,132 @@
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
using Microsoft.AspNetCore.Testing.xunit;
|
using Microsoft.Extensions.Logging.Testing;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace FunctionalTests
|
namespace FunctionalTests
|
||||||
{
|
{
|
||||||
public class RazorPagesAppTest : IClassFixture<RazorPagesAppTest.TestFixture>
|
public class RazorPagesAppTest_CoreCLR :
|
||||||
|
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<RazorPagesApp.Startup>>
|
||||||
{
|
{
|
||||||
public RazorPagesAppTest(TestFixture fixture)
|
public RazorPagesAppTest_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<RazorPagesApp.Startup> fixture,
|
||||||
|
ITestOutputHelper output)
|
||||||
|
: base(output)
|
||||||
{
|
{
|
||||||
Fixture = fixture;
|
Fixture = fixture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApplicationTestFixture Fixture { get; }
|
public ApplicationTestFixture Fixture { get; }
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
|
[Fact]
|
||||||
|
public async Task Precompilation_WorksForIndexPage_UsingFolderName()
|
||||||
[ConditionalTheory]
|
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
|
||||||
public async Task Precompilation_WorksForIndexPage_UsingFolderName(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
"/",
|
"/",
|
||||||
Fixture.Logger);
|
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[Fact]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
public async Task Precompilation_WorksForIndexPage_UsingFileName()
|
||||||
public async Task Precompilation_WorksForIndexPage_UsingFileName(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
"/Index",
|
"/Index",
|
||||||
Fixture.Logger);
|
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[Fact]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
public async Task Precompilation_WorksForPageWithModel()
|
||||||
public async Task Precompilation_WorksForPageWithModel(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
"/PageWithModel?person=Dan",
|
"/PageWithModel?person=Dan",
|
||||||
Fixture.Logger);
|
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response);
|
TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[Fact]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
public async Task Precompilation_WorksForPageWithRoute()
|
||||||
public async Task Precompilation_WorksForPageWithRoute(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
"/PageWithRoute/Dan",
|
"/PageWithRoute/Dan",
|
||||||
Fixture.Logger);
|
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response);
|
TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[Fact]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
public async Task Precompilation_WorksForPageInNestedFolder()
|
||||||
public async Task Precompilation_WorksForPageInNestedFolder(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||||
"/Nested1/Nested2/PageWithTagHelper",
|
"/Nested1/Nested2/PageWithTagHelper",
|
||||||
Fixture.Logger);
|
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response);
|
TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[Fact]
|
||||||
[MemberData(nameof(SupportedFlavorsTheoryData))]
|
public async Task Precompilation_WorksWithPageConventions()
|
||||||
public async Task Precompilation_WorksWithPageConventions(RuntimeFlavor flavor)
|
|
||||||
{
|
{
|
||||||
// Arrange
|
using (StartLog(out var loggerFactory))
|
||||||
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
|
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await RetryHelper.RetryRequest(
|
var response = await RetryHelper.RetryRequest(
|
||||||
() => deployment.HttpClient.GetAsync("/Auth/Index"),
|
() => deployment.HttpClient.GetAsync("/Auth/Index"),
|
||||||
Fixture.Logger,
|
loggerFactory.CreateLogger(Fixture.ApplicationName),
|
||||||
retryCount: 5);
|
retryCount: 5);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery);
|
Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestFixture : ApplicationTestFixture
|
|
||||||
{
|
|
||||||
public TestFixture()
|
|
||||||
: base("RazorPagesApp")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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<DesktopApplicationTestFixture<RazorPagesApp.Startup>>
|
||||||
|
{
|
||||||
|
public RazorPagesAppTest_Desktop(
|
||||||
|
DesktopApplicationTestFixture<RazorPagesApp.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<RuntimeFlavor> SupportedFlavors
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
yield return RuntimeFlavor.CoreClr;
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
{
|
|
||||||
yield return RuntimeFlavor.Clr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TheoryData SupportedFlavorsTheoryData
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var theory = new TheoryData<RuntimeFlavor>();
|
|
||||||
foreach (var item in SupportedFlavors)
|
|
||||||
{
|
|
||||||
theory.Add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return theory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<SimpleAppTest.SimpleAppTestFixture>
|
|
||||||
{
|
|
||||||
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")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<SimpleApp.Startup>>
|
||||||
|
{
|
||||||
|
public SimpleAppTest_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<SimpleApp.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DesktopApplicationTestFixture<SimpleApp.Startup>>
|
||||||
|
{
|
||||||
|
public SimpleAppTest_Desktop(
|
||||||
|
DesktopApplicationTestFixture<SimpleApp.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<SimpleAppWithAssemblyRenameTest.TestFixture>
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<SimpleAppWithAssemblyRenameTest_CoreCLR.TestFixture>
|
||||||
|
{
|
||||||
|
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<SimpleAppWithAssemblyRename.Startup>
|
||||||
|
{
|
||||||
|
public TestFixture()
|
||||||
|
: base(
|
||||||
|
typeof(SimpleAppWithAssemblyRename.Startup).Assembly.GetName().Name,
|
||||||
|
ApplicationPaths.GetTestAppDirectory(nameof(SimpleAppWithAssemblyRename)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<SimpleAppWithAssemblyRenameTest_Desktop.TestFixture>
|
||||||
|
{
|
||||||
|
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<SimpleAppWithAssemblyRename.Startup>
|
||||||
|
{
|
||||||
|
public TestFixture()
|
||||||
|
: base(
|
||||||
|
typeof(SimpleAppWithAssemblyRename.Startup).Assembly.GetName().Name,
|
||||||
|
ApplicationPaths.GetTestAppDirectory(nameof(SimpleAppWithAssemblyRename)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<SimpleAppX86DesktopOnlyTest.SimpleAppX86DesktopOnlyFixture>
|
|
||||||
{
|
|
||||||
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")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<StrongNamedAppTest.StrongNamedAppFixture>
|
|
||||||
{
|
|
||||||
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")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<StrongNamedApp.Startup>>
|
||||||
|
{
|
||||||
|
public StrongNamedAppTest_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<StrongNamedApp.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DesktopApplicationTestFixture<StrongNamedApp.Startup>>
|
||||||
|
{
|
||||||
|
public StrongNamedAppTest_Desktop(
|
||||||
|
DesktopApplicationTestFixture<StrongNamedApp.Startup> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<ViewCompilationOptionsTest.TestFixture>
|
|
||||||
{
|
|
||||||
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<string, string>("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")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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<CoreCLRApplicationTestFixture<SimpleApp.Startup>>
|
||||||
|
{
|
||||||
|
public ViewCompilationOptions_CoreCLR(
|
||||||
|
CoreCLRApplicationTestFixture<SimpleApp.Startup> 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<ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished.TestFixture>
|
||||||
|
{
|
||||||
|
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<SimpleApp.Startup>
|
||||||
|
{
|
||||||
|
protected override DeploymentParameters GetDeploymentParameters()
|
||||||
|
{
|
||||||
|
var deploymentParameters = base.GetDeploymentParameters();
|
||||||
|
deploymentParameters.PublishEnvironmentVariables.Add(
|
||||||
|
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
|
||||||
|
|
||||||
|
return deploymentParameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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<DesktopApplicationTestFixture<SimpleApp.Startup>>
|
||||||
|
{
|
||||||
|
public ViewCompilationOptions_Desktop(
|
||||||
|
DesktopApplicationTestFixture<SimpleApp.Startup> 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<ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished.TestFixture>
|
||||||
|
{
|
||||||
|
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<SimpleApp.Startup>
|
||||||
|
{
|
||||||
|
protected override DeploymentParameters GetDeploymentParameters()
|
||||||
|
{
|
||||||
|
var deploymentParameters = base.GetDeploymentParameters();
|
||||||
|
deploymentParameters.PublishEnvironmentVariables.Add(
|
||||||
|
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
|
||||||
|
|
||||||
|
return deploymentParameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace ApplicationWithTagHelpers
|
namespace ApplicationUsingPrecompiledViewClassLibrary
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace ApplicationWithTagHelpers
|
namespace ApplicationUsingPrecompiledViewClassLibrary
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace SimpleApp.Controllers
|
namespace SimpleAppDesktopOnly.Controllers
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace SimpleApp
|
namespace SimpleAppDesktopOnly
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace SimpleApp
|
namespace SimpleAppDesktopOnly
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - SimpleApp</title>
|
<title>@ViewData["Title"] - SimpleAppDesktopOnly</title>
|
||||||
|
|
||||||
<environment names="Development">
|
<environment names="Development">
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">SimpleApp</a>
|
<a asp-area="" asp-controller="Home" asp-action="Index" class="navbar-brand">SimpleAppDesktopOnly</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse">
|
<div class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
@RenderBody()
|
@RenderBody()
|
||||||
<hr />
|
<hr />
|
||||||
<footer>
|
<footer>
|
||||||
<p>© 2016 - SimpleApp</p>
|
<p>© 2016 - SimpleAppDesktopOnly</p>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
@using SimpleApp
|
@using SimpleAppDesktopOnly
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue