// 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 { 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.cs")}"); Assert.BuildOutputContainsLine(result, $"RazorCompile: {Path.Combine(IntermediateOutputPath, "SimpleMvc.RazorAssemblyInfo.cs")}"); } } }