Add a test that always publishes in Debug
Fixes #99 Also move some tests over to reduce unnecessary deployment
This commit is contained in:
parent
fcabcb2385
commit
81fa36f029
|
|
@ -43,11 +43,7 @@ namespace FunctionalTests
|
|||
ApplicationName = ApplicationName,
|
||||
PublishApplicationBeforeDeployment = true,
|
||||
TargetFramework = flavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
|
||||
#if DEBUG
|
||||
Configuration = "Debug",
|
||||
#else
|
||||
Configuration = "Release",
|
||||
#endif
|
||||
EnvironmentVariables =
|
||||
{
|
||||
telemetryOptOut,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
// 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.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class PublishWithDebugTest_CoreCLR :
|
||||
LoggedTest, IClassFixture<PublishWithDebugTest_CoreCLR.TestFixture>
|
||||
{
|
||||
public PublishWithDebugTest_CoreCLR(
|
||||
TestFixture fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task PublishingInDebugWorks()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : CoreCLRApplicationTestFixture<SimpleApp.Startup>
|
||||
{
|
||||
protected override DeploymentParameters GetDeploymentParameters()
|
||||
{
|
||||
var deploymentParameters = base.GetDeploymentParameters();
|
||||
deploymentParameters.Configuration = "Debug";
|
||||
|
||||
return deploymentParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
// 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 PublishWithDebugTest_Desktop :
|
||||
LoggedTest, IClassFixture<PublishWithDebugTest_Desktop.TestFixture>
|
||||
{
|
||||
public PublishWithDebugTest_Desktop(
|
||||
TestFixture fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task PublishingInDebugWorks()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : DesktopApplicationTestFixture<SimpleApp.Startup>
|
||||
{
|
||||
protected override DeploymentParameters GetDeploymentParameters()
|
||||
{
|
||||
var deploymentParameters = base.GetDeploymentParameters();
|
||||
deploymentParameters.Configuration = "Debug";
|
||||
|
||||
return deploymentParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
// 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.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
|
|
@ -38,5 +39,32 @@ namespace FunctionalTests
|
|||
TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// 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.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
|
|
@ -41,5 +42,32 @@ namespace FunctionalTests
|
|||
TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,47 +11,6 @@ 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>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,49 +12,6 @@ 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 :
|
||||
|
|
|
|||
Loading…
Reference in New Issue