aspnetcore/test/Microsoft.AspNetCore.Razor..../IntegrationTests/BuildServerIntegrationTest.cs

53 lines
2.2 KiB
C#

// 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 Xunit;
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
public class BuildServerIntegrationTest : MSBuildIntegrationTestBase, IClassFixture<BuildServerTestFixture>
{
private readonly string _pipeName;
public BuildServerIntegrationTest(BuildServerTestFixture fixture)
{
_pipeName = fixture.PipeName;
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public Task Build_SimpleMvc_WithServer_UsingDotnetMSBuild_CanBuildSuccessfully()
=> Build_SimpleMvc_CanBuildSuccessfully(MSBuildProcessKind.Dotnet);
private async Task Build_SimpleMvc_CanBuildSuccessfully(MSBuildProcessKind msBuildProcessKind)
{
var result = await DotnetMSBuild(
"Build",
$"/p:RazorCompileOnBuild=true /p:UseRazorBuildServer=true /p:_RazorBuildServerPipeName={_pipeName}",
msBuildProcessKind: msBuildProcessKind);
Assert.BuildPassed(result);
Assert.FileExists(result, OutputPath, "SimpleMvc.dll");
Assert.FileExists(result, OutputPath, "SimpleMvc.pdb");
Assert.FileExists(result, OutputPath, "SimpleMvc.PrecompiledViews.dll");
Assert.FileExists(result, OutputPath, "SimpleMvc.PrecompiledViews.pdb");
}
[Fact]
[InitializeTestProject("SimpleMvc", baseDirectory: "Whitespace in path", additionalProjects: new string[] { })]
public async Task Build_AppWithWhitespaceInPath_CanBuildSuccessfully()
{
var result = await DotnetMSBuild(
"Build",
$"/p:RazorCompileOnBuild=true /p:UseRazorBuildServer=true /p:_RazorBuildServerPipeName={_pipeName}");
Assert.BuildPassed(result);
Assert.FileExists(result, OutputPath, "SimpleMvc.dll");
Assert.FileExists(result, OutputPath, "SimpleMvc.pdb");
Assert.FileExists(result, OutputPath, "SimpleMvc.PrecompiledViews.dll");
Assert.FileExists(result, OutputPath, "SimpleMvc.PrecompiledViews.pdb");
}
}
}