// 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; using Xunit.Abstractions; namespace FunctionalTests { public class SimpleAppTest_CoreCLR : LoggedTest, IClassFixture> { public SimpleAppTest_CoreCLR( CoreCLRApplicationTestFixture fixture, ITestOutputHelper output) : base(output) { Fixture = fixture; } public ApplicationTestFixture Fixture { get; } [Fact] public async Task Precompilation_WorksForSimpleApps() { 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); } } [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."); } } } }