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

50 lines
2.0 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.IO;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
public class BuildIntrospectionTest : MSBuildIntegrationTestBase, IClassFixture<BuildServerTestFixture>
{
public BuildIntrospectionTest(BuildServerTestFixture buildServer)
: base(buildServer)
{
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task RazorSdk_AddsCshtmlFilesToUpToDateCheckInput()
{
var result = await DotnetMSBuild("_IntrospectUpToDateCheckInput");
Assert.BuildPassed(result);
Assert.BuildOutputContainsLine(result, $"UpToDateCheckInput: {Path.Combine("Views", "Home", "Index.cshtml")}");
Assert.BuildOutputContainsLine(result, $"UpToDateCheckInput: {Path.Combine("Views", "_ViewStart.cshtml")}");
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task RazorSdk_AddsGeneratedRazorFilesAndAssemblyInfoToRazorCompile()
{
var result = await DotnetMSBuild("Build", "/t:_IntrospectRazorCompileItems");
Assert.BuildPassed(result);
Assert.BuildOutputContainsLine(result, $"RazorCompile: {Path.Combine(IntermediateOutputPath, "Razor", "Views", "Home", "Index.g.cshtml.cs")}");
Assert.BuildOutputContainsLine(result, $"RazorCompile: {Path.Combine(IntermediateOutputPath, "SimpleMvc.RazorAssemblyInfo.cs")}");
}
[Fact]
[InitializeTestProject("SimpleMvc")]
public async Task RazorSdk_UsesUseSharedCompilationToSetDefaultValueOfUseRazorBuildServer()
{
var result = await DotnetMSBuild("Build", "/t:_IntrospectUseRazorBuildServer /p:UseSharedCompilation=false");
Assert.BuildPassed(result);
Assert.BuildOutputContainsLine(result, "UseRazorBuildServer: false");
}
}
}