// 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.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; using Xunit; namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation { public class SimpleAppTest : IClassFixture { public SimpleAppTest(SimpleAppTestFixture fixture) { Fixture = fixture; } public ApplicationTestFixture Fixture { get; } public static IEnumerable SupportedFlavorsTheoryData { get { return RuntimeFlavors.SupportedFlavors.Select(f => new object[] { f }); } } [Theory] [MemberData(nameof(SupportedFlavorsTheoryData))] public async Task Precompilation_WorksForSimpleApps(RuntimeFlavor flavor) { // Arrange using (var deployer = Fixture.CreateDeployment(flavor)) { var deploymentResult = deployer.Deploy(); var httpClient = new HttpClient() { BaseAddress = new Uri(deploymentResult.ApplicationBaseUri) }; // Act var response = await httpClient.GetStringWithRetryAsync("", Fixture.Logger); // Assert TestEmbeddedResource.AssertContent("SimpleAppTest.Home.Index.txt", response); } } public class SimpleAppTestFixture : ApplicationTestFixture { public SimpleAppTestFixture() : base("SimpleApp") { } } } }