parent
de8aa5bffa
commit
9b05f240ae
|
|
@ -259,6 +259,22 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[InitializeTestProject("SimpleMvc")]
|
||||
public async Task Build_WithPreserveCompilationReferencesEnabled_ProducesRefsDirectory()
|
||||
{
|
||||
// This simulates the behavior of 3.0 with RuntimeCompilation enabled
|
||||
AddProjectFileContent(@"
|
||||
<PropertyGroup>
|
||||
<PreserveCompilationReferences>true</PreserveCompilationReferences>
|
||||
</PropertyGroup>");
|
||||
|
||||
var result = await DotnetMSBuild("Build");
|
||||
|
||||
// Verify no refs folder is produced
|
||||
Assert.FileExists(result, OutputPath, "refs", "mscorlib.dll");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[InitializeTestProject("ClassLibrary")]
|
||||
public async Task Build_CodeGensAssemblyInfoUsingValuesFromProject()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
|
|
@ -8,33 +9,69 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||
{
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
public class BuildIntegrationTest22NetFx : BuildIntegrationTestLegacy
|
||||
public class BuildIntegrationTest22NetFx :
|
||||
MSBuildIntegrationTestBase,
|
||||
IClassFixture<LegacyBuildServerTestFixture>
|
||||
{
|
||||
private const string TestProjectName = "SimpleMvc22NetFx";
|
||||
|
||||
public BuildIntegrationTest22NetFx(LegacyBuildServerTestFixture buildServer)
|
||||
: base(buildServer)
|
||||
{
|
||||
}
|
||||
|
||||
public override string TestProjectName => "SimpleMvc22NetFx";
|
||||
public override string TargetFramework => "net461";
|
||||
public override string OutputFileName => $"{TestProjectName}.exe";
|
||||
public string OutputFileName => $"{TestProjectName}.exe";
|
||||
|
||||
[Fact]
|
||||
public override async Task BuildingProject_CopyToOutputDirectoryFiles()
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[InitializeTestProject(TestProjectName)]
|
||||
public async Task BuildingProject_CopyToOutputDirectoryFiles()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
{
|
||||
// Build
|
||||
var result = await DotnetMSBuild("Build");
|
||||
TargetFramework = "net461";
|
||||
|
||||
Assert.BuildPassed(result);
|
||||
// No cshtml files should be in the build output directory
|
||||
Assert.FileCountEquals(result, 0, Path.Combine(OutputPath, "Views"), "*.cshtml");
|
||||
// Build
|
||||
var result = await DotnetMSBuild("Build");
|
||||
|
||||
// refs are required for runtime compilation in desktop targeting projects.
|
||||
Assert.FileCountEquals(result, 97, Path.Combine(OutputPath, "refs"), "*.dll");
|
||||
}
|
||||
Assert.BuildPassed(result);
|
||||
// No cshtml files should be in the build output directory
|
||||
Assert.FileCountEquals(result, 0, Path.Combine(OutputPath, "Views"), "*.cshtml");
|
||||
|
||||
// refs are required for runtime compilation in desktop targeting projects.
|
||||
Assert.FileCountEquals(result, 97, Path.Combine(OutputPath, "refs"), "*.dll");
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[InitializeTestProject(TestProjectName)]
|
||||
public async Task PublishingProject_CopyToOutputDirectoryFiles()
|
||||
{
|
||||
TargetFramework = "net461";
|
||||
|
||||
// Build
|
||||
var result = await DotnetMSBuild("Publish");
|
||||
|
||||
Assert.BuildPassed(result);
|
||||
// No cshtml files should be in the build output directory
|
||||
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
|
||||
|
||||
// refs shouldn't be produced by default
|
||||
Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll");
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[InitializeTestProject(TestProjectName)]
|
||||
public async Task PublishingProject_CopyToOutputDirectoryFiles_WithCopyRefAssembliesToPublishDirectory()
|
||||
{
|
||||
TargetFramework = "net461";
|
||||
|
||||
// Build
|
||||
var result = await DotnetMSBuild("Publish", "/p:CopyRefAssembliesToPublishDirectory=true");
|
||||
|
||||
Assert.BuildPassed(result);
|
||||
|
||||
// refs should be present if CopyRefAssembliesToPublishDirectory is set.
|
||||
Assert.FileExists(result, PublishOutputPath, "refs", "System.Threading.Tasks.Extensions.dll");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
||||
|
|
@ -30,7 +29,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
return new Disposable();
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[Fact]
|
||||
public virtual async Task Building_Project()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
|
|
@ -55,7 +54,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[Fact]
|
||||
public virtual async Task BuildingProject_CopyToOutputDirectoryFiles()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
|
|
@ -72,7 +71,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[Fact]
|
||||
public virtual async Task Publish_Project()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
|
|
@ -92,7 +91,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[Fact]
|
||||
public virtual async Task Publish_NoopsWithMvcRazorCompileOnPublish_False()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
|
|
@ -109,7 +108,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact] // This will use the old precompilation tool, RazorSDK shouldn't get involved.
|
||||
[Fact] // This will use the old precompilation tool, RazorSDK shouldn't get involved.
|
||||
public virtual async Task Build_WithMvcRazorCompileOnPublish_Noops()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
|
|
@ -125,7 +124,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[Fact]
|
||||
public virtual async Task Build_DoesNotAddRelatedAssemblyPart_IfToolSetIsNotRazorSdk()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
|
|
@ -140,7 +139,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[Fact]
|
||||
public virtual async Task Build_DoesNotPrintsWarnings_IfProjectFileContainsRazorFiles()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
|
|
@ -153,7 +152,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[Fact]
|
||||
public virtual async Task Publish_IncludesRefAssemblies_WhenCopyRefAssembliesToPublishDirectoryIsSet()
|
||||
{
|
||||
using (CreateTestProject())
|
||||
|
|
|
|||
|
|
@ -248,6 +248,29 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
Assert.FileCountEquals(result, 8, Path.Combine(PublishOutputPath, "Views"), "*.cshtml");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[InitializeTestProject("SimpleMvc")]
|
||||
public async Task Publish_WithPreserveCompilationReferencesSetInProjectFile_CopiesRefs()
|
||||
{
|
||||
// This simulates the behavior of 3.0 with RuntimeCompilation enabled
|
||||
AddProjectFileContent(@"
|
||||
<PropertyGroup>
|
||||
<PreserveCompilationReferences>true</PreserveCompilationReferences>
|
||||
</PropertyGroup>");
|
||||
|
||||
var result = await DotnetMSBuild("Publish");
|
||||
|
||||
Assert.BuildPassed(result);
|
||||
|
||||
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.dll");
|
||||
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.pdb");
|
||||
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.Views.dll");
|
||||
Assert.FileExists(result, PublishOutputPath, "SimpleMvc.Views.pdb");
|
||||
|
||||
// By default refs and .cshtml files will not be copied on publish
|
||||
Assert.FileExists(result, PublishOutputPath, "refs", "mscorlib.dll");
|
||||
}
|
||||
|
||||
[Fact] // Tests old MvcPrecompilation behavior that we support for compat.
|
||||
[InitializeTestProject("SimpleMvc")]
|
||||
public async Task Publish_MvcRazorExcludeFilesFromPublish_False_CopiesFiles()
|
||||
|
|
|
|||
Loading…
Reference in New Issue