aspnetcore/test/Microsoft.AspNetCore.Mvc.Ra.../ApplicationConsumingPrecomp...

45 lines
1.7 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 Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
{
public class ApplicationConsumingPrecompiledViews
: IClassFixture<ApplicationConsumingPrecompiledViews.ApplicationConsumingPrecompiledViewsFixture>
{
public ApplicationConsumingPrecompiledViews(ApplicationConsumingPrecompiledViewsFixture fixture)
{
Fixture = fixture;
}
public ApplicationTestFixture Fixture { get; }
public static TheoryData SupportedFlavorsTheoryData => RuntimeFlavors.SupportedFlavorsTheoryData;
[ConditionalTheory]
[MemberData(nameof(SupportedFlavorsTheoryData))]
public async Task ConsumingClassLibrariesWithPrecompiledViewsWork(RuntimeFlavor flavor)
{
using (var deployment = await Fixture.CreateDeploymentAsync(flavor))
{
// Act
var response = await deployment.HttpClient.GetStringWithRetryAsync("Manage/Home", Fixture.Logger);
// Assert
TestEmbeddedResource.AssertContent("ApplicationConsumingPrecompiledViews.Manage.Home.Index.txt", response);
}
}
public class ApplicationConsumingPrecompiledViewsFixture : ApplicationTestFixture
{
public ApplicationConsumingPrecompiledViewsFixture()
: base("ApplicationUsingPrecompiledViewClassLibrary")
{
}
}
}
}