64 lines
2.3 KiB
C#
64 lines
2.3 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.Testing.xunit;
|
|
using Microsoft.Extensions.Logging.Testing;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace FunctionalTests
|
|
{
|
|
[OSSkipCondition(OperatingSystems.Linux)]
|
|
[OSSkipCondition(OperatingSystems.MacOSX)]
|
|
public class ApplicationUsingRelativePathsTest_Desktop :
|
|
LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationUsingRelativePaths.Startup>>
|
|
{
|
|
public ApplicationUsingRelativePathsTest_Desktop(
|
|
DesktopApplicationTestFixture<ApplicationUsingRelativePaths.Startup> fixture,
|
|
ITestOutputHelper output)
|
|
: base(output)
|
|
{
|
|
Fixture = fixture;
|
|
}
|
|
|
|
public ApplicationTestFixture Fixture { get; }
|
|
|
|
[ConditionalFact]
|
|
public async Task Precompilation_WorksForViewsUsingRelativePath()
|
|
{
|
|
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("ApplicationUsingRelativePaths.Home.Index.txt", response);
|
|
}
|
|
}
|
|
|
|
[ConditionalFact]
|
|
public async Task Precompilation_WorksForViewsUsingDirectoryTraversal()
|
|
{
|
|
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("ApplicationUsingRelativePaths.Home.About.txt", response);
|
|
}
|
|
}
|
|
}
|
|
}
|