Keep a couple of tests and remove most tests from 2.1
Fixes https://github.com/aspnet/MvcPrecompilation/issues/293
This commit is contained in:
parent
64b65b6991
commit
617586a984
|
|
@ -1,60 +0,0 @@
|
|||
// 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.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class ApplicationUsingRelativePathsTest_CoreCLR :
|
||||
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationUsingRelativePaths.Startup>>
|
||||
{
|
||||
public ApplicationUsingRelativePathsTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<ApplicationUsingRelativePaths.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
// 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.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class ApplicationWithConfigureMvcTest_CoreCLR
|
||||
: LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithConfigureStartup.Startup>>
|
||||
{
|
||||
public ApplicationWithConfigureMvcTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<ApplicationWithConfigureStartup.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task Precompilation_RunsConfiguredCompilationCallbacks()
|
||||
{
|
||||
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("ApplicationWithConfigureMvc.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Precompilation_UsesConfiguredParseOptions()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/ViewWithPreprocessor",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent(
|
||||
"ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt",
|
||||
response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
// 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.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class ApplicationWithCustomInputFilesTest_CoreCLR
|
||||
: LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithCustomInputFiles.Startup>>
|
||||
{
|
||||
public ApplicationWithCustomInputFilesTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<ApplicationWithCustomInputFiles.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task ApplicationWithCustomInputFiles_Works()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var expectedText = "Hello Index!";
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.ApplicationBaseUri,
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedText, response.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var expectedViews = new[]
|
||||
{
|
||||
"/Views/Home/About.cshtml",
|
||||
"/Views/Home/Index.cshtml",
|
||||
};
|
||||
|
||||
// Act
|
||||
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/GetPrecompiledResourceNames",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
|
||||
Assert.Equal(expectedViews, actual);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var viewsNotPublished = new[]
|
||||
{
|
||||
"Index.cshtml",
|
||||
"About.cshtml",
|
||||
};
|
||||
|
||||
var viewsPublished = new[]
|
||||
{
|
||||
"NotIncluded.cshtml",
|
||||
};
|
||||
var viewsDirectory = Path.Combine(deployment.ContentRoot, "Views", "Home");
|
||||
|
||||
// Act & Assert
|
||||
foreach (var file in viewsPublished)
|
||||
{
|
||||
var filePath = Path.Combine(viewsDirectory, file);
|
||||
Assert.True(File.Exists(filePath), $"{filePath} was not published.");
|
||||
}
|
||||
|
||||
foreach (var file in viewsNotPublished)
|
||||
{
|
||||
var filePath = Path.Combine(viewsDirectory, file);
|
||||
Assert.False(File.Exists(filePath), $"{filePath} was published.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
// 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.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class ApplicationWithParseErrorsTest_CoreCLR
|
||||
: IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithParseErrors.Startup>>
|
||||
{
|
||||
public ApplicationWithParseErrorsTest_CoreCLR(CoreCLRApplicationTestFixture<ApplicationWithParseErrors.Startup> fixture)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task PublishingPrintsParseErrors()
|
||||
{
|
||||
// Arrange
|
||||
var applicationPath = ApplicationPaths.GetTestAppDirectory("ApplicationWithParseErrors");
|
||||
var indexPath = Path.Combine(applicationPath, "Views", "Home", "Index.cshtml");
|
||||
var viewImportsPath = Path.Combine(applicationPath, "Views", "Home", "About.cshtml");
|
||||
var expectedErrors = new[]
|
||||
{
|
||||
indexPath + " (0): The code block is missing a closing \"}\" character. Make sure you have a matching \"}\" character for all the \"{\" characters within this block, and that none of the \"}\" characters are being interpreted as markup.",
|
||||
viewImportsPath + " (1): A space or line break was encountered after the \"@\" character. Only valid identifiers, keywords, comments, \"(\" and \"{\" are valid at the start of a code block and they must occur immediately following \"@\" with no space in between.",
|
||||
|
||||
};
|
||||
var testSink = new TestSink();
|
||||
var loggerFactory = new TestLoggerFactory(testSink, enabled: true);
|
||||
|
||||
// Act
|
||||
await Assert.ThrowsAsync<Exception>(() => Fixture.CreateDeploymentAsync(loggerFactory));
|
||||
|
||||
// Assert
|
||||
var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
|
||||
foreach (var expectedError in expectedErrors)
|
||||
{
|
||||
Assert.Contains(logs, log => log.Contains(expectedError));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
// 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.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class ApplicationWithTagHelpersTest_CoreCLR :
|
||||
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithTagHelpers.Startup>>
|
||||
{
|
||||
public ApplicationWithTagHelpersTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<ApplicationWithTagHelpers.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task Precompilation_WorksForViewsThatUseTagHelpersFromProjectReferences()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/ClassLibraryTagHelper",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Precompilation_WorksForViewsThatUseTagHelpersFromCurrentProject()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/LocalTagHelper",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.LocalTagHelper.txt", response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
// 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.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class PublishWithDebugTest_CoreCLR :
|
||||
LoggedTest, IClassFixture<PublishWithDebugTest_CoreCLR.TestFixture>
|
||||
{
|
||||
public PublishWithDebugTest_CoreCLR(
|
||||
TestFixture fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task PublishingInDebugWorks()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Assert
|
||||
var expected = Path.Combine(deployment.ContentRoot, $"{Fixture.ApplicationName}.PrecompiledViews.dll");
|
||||
Assert.True(File.Exists(expected), $"File {expected} does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : CoreCLRApplicationTestFixture<SimpleApp.Startup>
|
||||
{
|
||||
public TestFixture()
|
||||
{
|
||||
PublishOnly = true;
|
||||
}
|
||||
|
||||
protected override DeploymentParameters GetDeploymentParameters()
|
||||
{
|
||||
var deploymentParameters = base.GetDeploymentParameters();
|
||||
deploymentParameters.Configuration = "Debug";
|
||||
|
||||
return deploymentParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
// 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.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class PublishWithEmbedViewSourcesTest_CoreCLR
|
||||
: LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<PublishWithEmbedViewSources.Startup>>
|
||||
{
|
||||
public PublishWithEmbedViewSourcesTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<PublishWithEmbedViewSources.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task Precompilation_CanEmbedViewSourcesAsResources()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var logger = loggerFactory.CreateLogger(Fixture.ApplicationName);
|
||||
var expectedViews = new[]
|
||||
{
|
||||
"/Areas/TestArea/Views/Home/Index.cshtml",
|
||||
"/Views/Home/About.cshtml",
|
||||
"/Views/Home/Index.cshtml",
|
||||
};
|
||||
var expectedText = "Hello Index!";
|
||||
|
||||
// Act - 1
|
||||
var response1 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/Index",
|
||||
logger);
|
||||
|
||||
// Assert - 1
|
||||
Assert.Equal(expectedText, response1.Trim());
|
||||
|
||||
// Act - 2
|
||||
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/GetPrecompiledResourceNames",
|
||||
logger);
|
||||
|
||||
// Assert - 2
|
||||
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
|
||||
Assert.Equal(expectedViews, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,134 +0,0 @@
|
|||
// 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.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class RazorPagesAppTest_CoreCLR :
|
||||
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<RazorPagesApp.Startup>>
|
||||
{
|
||||
public RazorPagesAppTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<RazorPagesApp.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
|
||||
public async Task Precompilation_WorksForIndexPage_UsingFolderName()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
|
||||
public async Task Precompilation_WorksForIndexPage_UsingFileName()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/Index",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
|
||||
public async Task Precompilation_WorksForPageWithModel()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/PageWithModel?person=Dan",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
|
||||
public async Task Precompilation_WorksForPageWithRoute()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/PageWithRoute/Dan",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
|
||||
public async Task Precompilation_WorksForPageInNestedFolder()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/Nested1/Nested2/PageWithTagHelper",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact(Skip = "https://github.com/aspnet/MvcPrecompilation/issues/287")]
|
||||
public async Task Precompilation_WorksWithPageConventions()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await RetryHelper.RetryRequest(
|
||||
() => deployment.HttpClient.GetAsync("/Auth/Index"),
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName),
|
||||
retryCount: 5);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
// 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.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
// Tests that cover cases where both Razor SDK and MvcPrecompilation are installed. This is the default in 2.1
|
||||
public class RazorSdkNeitherUsedTest_CoreCLR : LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithRazorSdkNeitherUsed.Startup>>
|
||||
{
|
||||
public RazorSdkNeitherUsedTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<ApplicationWithRazorSdkNeitherUsed.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task Publish_HasNoPrecompilation()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await RetryHelper.RetryRequest(
|
||||
() => deployment.HttpClient.GetAsync(deployment.ApplicationBaseUri),
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName),
|
||||
retryCount: 5);
|
||||
|
||||
// Assert
|
||||
Assert.False(File.Exists(Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkNeitherUsed.PrecompiledViews.dll")));
|
||||
Assert.False(File.Exists(Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkNeitherUsed.Views.dll")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
// 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
|
||||
{
|
||||
// Tests that cover cases where both Razor SDK and MvcPrecompilation are installed. This is the default in 2.1
|
||||
public class RazorSdkPrecompilationUsedTest_CoreCLR : LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithRazorSdkPrecompilationUsed.Startup>>
|
||||
{
|
||||
public RazorSdkPrecompilationUsedTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<ApplicationWithRazorSdkPrecompilationUsed.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task Publish_UsesRazorSDK()
|
||||
{
|
||||
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
|
||||
Assert.True(File.Exists(Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkPrecompilationUsed.PrecompiledViews.dll")));
|
||||
Assert.False(File.Exists(Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkPrecompilationUsed.Views.dll")));
|
||||
TestEmbeddedResource.AssertContent("ApplicationWithRazorSdkPrecompilationUsed.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
// 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
|
||||
{
|
||||
// Tests that cover cases where both Razor SDK and MvcPrecompilation are installed. This is the default in 2.1
|
||||
public class RazorSdkUsedTest_CoreCLR : LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<ApplicationWithRazorSdkUsed.Startup>>
|
||||
{
|
||||
public RazorSdkUsedTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<ApplicationWithRazorSdkUsed.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task Publish_UsesRazorSDK()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var expectedViewLocation = Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkUsed.Views.dll");
|
||||
var expectedPrecompiledViewsLocation = Path.Combine(deployment.ContentRoot, "ApplicationWithRazorSdkUsed.PrecompiledViews.dll");
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.ApplicationBaseUri,
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
Assert.False(File.Exists(expectedPrecompiledViewsLocation), $"{expectedPrecompiledViewsLocation} existed, but shouldn't have.");
|
||||
Assert.True(File.Exists(expectedViewLocation), $"{expectedViewLocation} didn't exist.");
|
||||
TestEmbeddedResource.AssertContent("ApplicationWithRazorSdkUsed.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ namespace FunctionalTests
|
|||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact(Skip = "Unblocking the build - https://github.com/aspnet/MvcPrecompilation/issues/224")]
|
||||
[Fact]
|
||||
public async Task Precompilation_WorksForSimpleApps()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
// 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.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class SimpleAppWithAssemblyRenameTest_CoreCLR :
|
||||
LoggedTest, IClassFixture<SimpleAppWithAssemblyRenameTest_CoreCLR.TestFixture>
|
||||
{
|
||||
public SimpleAppWithAssemblyRenameTest_CoreCLR(
|
||||
TestFixture 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("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : CoreCLRApplicationTestFixture<SimpleAppWithAssemblyRename.Startup>
|
||||
{
|
||||
public TestFixture()
|
||||
: base(
|
||||
typeof(SimpleAppWithAssemblyRename.Startup).Assembly.GetName().Name,
|
||||
ApplicationPaths.GetTestAppDirectory(nameof(SimpleAppWithAssemblyRename)))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
// 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.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class StrongNamedAppTest_CoreCLR :
|
||||
LoggedTest, IClassFixture<CoreCLRApplicationTestFixture<StrongNamedApp.Startup>>
|
||||
{
|
||||
public StrongNamedAppTest_CoreCLR(
|
||||
CoreCLRApplicationTestFixture<StrongNamedApp.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication()
|
||||
{
|
||||
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("StrongNamedApp.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
// 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.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
public class ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished :
|
||||
LoggedTest, IClassFixture<ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished.TestFixture>
|
||||
{
|
||||
public ViewCompilationOptions_CoreCLR_ScenarioRefAssembliesDoNotGetPublished(
|
||||
TestFixture fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[Fact]
|
||||
public async Task PublishingWithOption_AllowsPublishingRefAssemblies()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act & Assert
|
||||
Assert.True(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs")));
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : CoreCLRApplicationTestFixture<SimpleApp.Startup>
|
||||
{
|
||||
public TestFixture()
|
||||
{
|
||||
PublishOnly = true;
|
||||
}
|
||||
|
||||
protected override DeploymentParameters GetDeploymentParameters()
|
||||
{
|
||||
var deploymentParameters = base.GetDeploymentParameters();
|
||||
deploymentParameters.PublishEnvironmentVariables.Add(
|
||||
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
|
||||
|
||||
return deploymentParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
// 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 ApplicationWithConfigureMvcTest_Desktop
|
||||
: LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationWithConfigureStartup.Startup>>
|
||||
{
|
||||
public ApplicationWithConfigureMvcTest_Desktop(
|
||||
DesktopApplicationTestFixture<ApplicationWithConfigureStartup.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_RunsConfiguredCompilationCallbacks()
|
||||
{
|
||||
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("ApplicationWithConfigureMvc.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_UsesConfiguredParseOptions()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/ViewWithPreprocessor",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent(
|
||||
"ApplicationWithConfigureMvc.Home.ViewWithPreprocessor.txt",
|
||||
response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
// 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.IO;
|
||||
using System.Linq;
|
||||
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 ApplicationWithCustomInputFilesTest_Desktop
|
||||
: LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationWithCustomInputFiles.Startup>>
|
||||
{
|
||||
public ApplicationWithCustomInputFilesTest_Desktop(
|
||||
DesktopApplicationTestFixture<ApplicationWithCustomInputFiles.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task ApplicationWithCustomInputFiles_Works()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var expectedText = "Hello Index!";
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
deployment.ApplicationBaseUri,
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedText, response.Trim());
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task MvcRazorFilesToCompile_OverridesTheFilesToBeCompiled()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var expectedViews = new[]
|
||||
{
|
||||
"/Views/Home/About.cshtml",
|
||||
"/Views/Home/Index.cshtml",
|
||||
};
|
||||
|
||||
// Act
|
||||
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/GetPrecompiledResourceNames",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
|
||||
Assert.Equal(expectedViews, actual);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task MvcRazorFilesToCompile_SpecificallyDoesNotPublishFilesToBeCompiled()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var viewsNotPublished = new[]
|
||||
{
|
||||
"Index.cshtml",
|
||||
"About.cshtml",
|
||||
};
|
||||
|
||||
var viewsPublished = new[]
|
||||
{
|
||||
"NotIncluded.cshtml",
|
||||
};
|
||||
var viewsDirectory = Path.Combine(deployment.ContentRoot, "Views", "Home");
|
||||
|
||||
// Act & Assert
|
||||
foreach (var file in viewsPublished)
|
||||
{
|
||||
var filePath = Path.Combine(viewsDirectory, file);
|
||||
Assert.True(File.Exists(filePath), $"{filePath} was not published.");
|
||||
}
|
||||
|
||||
foreach (var file in viewsNotPublished)
|
||||
{
|
||||
var filePath = Path.Combine(viewsDirectory, file);
|
||||
Assert.False(File.Exists(filePath), $"{filePath} was published.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
// 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.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
[OSSkipCondition(OperatingSystems.Linux)]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||
public class ApplicationWithParseErrorsTest_Desktop
|
||||
: IClassFixture<DesktopApplicationTestFixture<ApplicationWithParseErrors.Startup>>
|
||||
{
|
||||
public ApplicationWithParseErrorsTest_Desktop(DesktopApplicationTestFixture<ApplicationWithParseErrors.Startup> fixture)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task PublishingPrintsParseErrors()
|
||||
{
|
||||
// Arrange
|
||||
var applicationPath = ApplicationPaths.GetTestAppDirectory("ApplicationWithParseErrors");
|
||||
var indexPath = Path.Combine(applicationPath, "Views", "Home", "Index.cshtml");
|
||||
var viewImportsPath = Path.Combine(applicationPath, "Views", "Home", "About.cshtml");
|
||||
var expectedErrors = new[]
|
||||
{
|
||||
indexPath + " (0): The code block is missing a closing \"}\" character. Make sure you have a matching \"}\" character for all the \"{\" characters within this block, and that none of the \"}\" characters are being interpreted as markup.",
|
||||
viewImportsPath + " (1): A space or line break was encountered after the \"@\" character. Only valid identifiers, keywords, comments, \"(\" and \"{\" are valid at the start of a code block and they must occur immediately following \"@\" with no space in between.",
|
||||
|
||||
};
|
||||
var testSink = new TestSink();
|
||||
var loggerFactory = new TestLoggerFactory(testSink, enabled: true);
|
||||
|
||||
// Act
|
||||
await Assert.ThrowsAsync<Exception>(() => Fixture.CreateDeploymentAsync(loggerFactory));
|
||||
|
||||
// Assert
|
||||
var logs = testSink.Writes.Select(w => w.State.ToString().Trim()).ToList();
|
||||
foreach (var expectedError in expectedErrors)
|
||||
{
|
||||
Assert.Contains(logs, log => log.Contains(expectedError));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
// 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 ApplicationWithTagHelpersTest_Desktop :
|
||||
LoggedTest, IClassFixture<DesktopApplicationTestFixture<ApplicationWithTagHelpers.Startup>>
|
||||
{
|
||||
public ApplicationWithTagHelpersTest_Desktop(
|
||||
DesktopApplicationTestFixture<ApplicationWithTagHelpers.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksForViewsThatUseTagHelpersFromProjectReferences()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/ClassLibraryTagHelper",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.ClassLibraryTagHelper.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksForViewsThatUseTagHelpersFromCurrentProject()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/LocalTagHelper",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent($"ApplicationWithTagHelpers.Home.LocalTagHelper.txt", response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
// 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.AspNetCore.Server.IntegrationTesting;
|
||||
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 PublishWithDebugTest_Desktop :
|
||||
LoggedTest, IClassFixture<PublishWithDebugTest_Desktop.TestFixture>
|
||||
{
|
||||
public PublishWithDebugTest_Desktop(
|
||||
TestFixture fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task PublishingInDebugWorks()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Assert
|
||||
var expected = Path.Combine(deployment.ContentRoot, $"{Fixture.ApplicationName}.PrecompiledViews.dll");
|
||||
Assert.True(File.Exists(expected), $"File {expected} does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : DesktopApplicationTestFixture<SimpleApp.Startup>
|
||||
{
|
||||
public TestFixture()
|
||||
{
|
||||
PublishOnly = true;
|
||||
}
|
||||
|
||||
protected override DeploymentParameters GetDeploymentParameters()
|
||||
{
|
||||
var deploymentParameters = base.GetDeploymentParameters();
|
||||
deploymentParameters.Configuration = "Debug";
|
||||
|
||||
return deploymentParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
// 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.Linq;
|
||||
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 PublishWithEmbedViewSourcesTest_Desktop
|
||||
: LoggedTest, IClassFixture<DesktopApplicationTestFixture<PublishWithEmbedViewSources.Startup>>
|
||||
{
|
||||
public PublishWithEmbedViewSourcesTest_Desktop(
|
||||
DesktopApplicationTestFixture<PublishWithEmbedViewSources.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_CanEmbedViewSourcesAsResources()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
var logger = loggerFactory.CreateLogger(Fixture.ApplicationName);
|
||||
var expectedViews = new[]
|
||||
{
|
||||
"/Areas/TestArea/Views/Home/Index.cshtml",
|
||||
"/Views/Home/About.cshtml",
|
||||
"/Views/Home/Index.cshtml",
|
||||
};
|
||||
var expectedText = "Hello Index!";
|
||||
|
||||
// Act - 1
|
||||
var response1 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/Index",
|
||||
logger);
|
||||
|
||||
// Assert - 1
|
||||
Assert.Equal(expectedText, response1.Trim());
|
||||
|
||||
// Act - 2
|
||||
var response2 = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"Home/GetPrecompiledResourceNames",
|
||||
logger);
|
||||
|
||||
// Assert - 2
|
||||
var actual = response2.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.OrderBy(p => p, StringComparer.OrdinalIgnoreCase);
|
||||
Assert.Equal(expectedViews, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
// 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 Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace FunctionalTests
|
||||
{
|
||||
[OSSkipCondition(OperatingSystems.Linux)]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX)]
|
||||
public class RazorPagesAppTest_Desktop :
|
||||
LoggedTest, IClassFixture<DesktopApplicationTestFixture<RazorPagesApp.Startup>>
|
||||
{
|
||||
public RazorPagesAppTest_Desktop(
|
||||
DesktopApplicationTestFixture<RazorPagesApp.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksForIndexPage_UsingFolderName()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksForIndexPage_UsingFileName()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/Index",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksForPageWithModel()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/PageWithModel?person=Dan",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.PageWithModel.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksForPageWithRoute()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/PageWithRoute/Dan",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.PageWithRoute.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksForPageInNestedFolder()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await deployment.HttpClient.GetStringWithRetryAsync(
|
||||
"/Nested1/Nested2/PageWithTagHelper",
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName));
|
||||
|
||||
// Assert
|
||||
TestEmbeddedResource.AssertContent("RazorPages.Nested1.Nested2.PageWithTagHelper.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksWithPageConventions()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act
|
||||
var response = await RetryHelper.RetryRequest(
|
||||
() => deployment.HttpClient.GetAsync("/Auth/Index"),
|
||||
loggerFactory.CreateLogger(Fixture.ApplicationName),
|
||||
retryCount: 5);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("/Login?ReturnUrl=%2FAuth%2FIndex", response.RequestMessage.RequestUri.PathAndQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ namespace FunctionalTests
|
|||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact(Skip = "Unblocking the build - https://github.com/aspnet/MvcPrecompilation/issues/224")]
|
||||
[ConditionalFact]
|
||||
public async Task Precompilation_WorksForSimpleApps()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
// 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 SimpleAppWithAssemblyRenameTest_Desktop :
|
||||
LoggedTest, IClassFixture<SimpleAppWithAssemblyRenameTest_Desktop.TestFixture>
|
||||
{
|
||||
public SimpleAppWithAssemblyRenameTest_Desktop(
|
||||
TestFixture fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
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("SimpleAppWithAssemblyRenameTest.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : DesktopApplicationTestFixture<SimpleAppWithAssemblyRename.Startup>
|
||||
{
|
||||
public TestFixture()
|
||||
: base(
|
||||
typeof(SimpleAppWithAssemblyRename.Startup).Assembly.GetName().Name,
|
||||
ApplicationPaths.GetTestAppDirectory(nameof(SimpleAppWithAssemblyRename)))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
// 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 StrongNamedAppTest_Desktop :
|
||||
LoggedTest, IClassFixture<DesktopApplicationTestFixture<StrongNamedApp.Startup>>
|
||||
{
|
||||
public StrongNamedAppTest_Desktop(
|
||||
DesktopApplicationTestFixture<StrongNamedApp.Startup> fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task PrecompiledAssembliesUseSameStrongNameAsApplication()
|
||||
{
|
||||
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("StrongNamedApp.Home.Index.txt", response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
// 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.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
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 ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished :
|
||||
LoggedTest, IClassFixture<ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished.TestFixture>
|
||||
{
|
||||
public ViewCompilationOptions_Desktop_ScenarioRefAssembliesDoNotGetPublished(
|
||||
TestFixture fixture,
|
||||
ITestOutputHelper output)
|
||||
: base(output)
|
||||
{
|
||||
Fixture = fixture;
|
||||
}
|
||||
|
||||
public ApplicationTestFixture Fixture { get; }
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task PublishingWithOption_AllowsPublishingRefAssemblies()
|
||||
{
|
||||
using (StartLog(out var loggerFactory))
|
||||
{
|
||||
// Arrange
|
||||
var deployment = await Fixture.CreateDeploymentAsync(loggerFactory);
|
||||
|
||||
// Act & Assert
|
||||
Assert.True(Directory.Exists(Path.Combine(deployment.ContentRoot, "refs")));
|
||||
}
|
||||
}
|
||||
|
||||
public class TestFixture : DesktopApplicationTestFixture<SimpleApp.Startup>
|
||||
{
|
||||
public TestFixture()
|
||||
{
|
||||
PublishOnly = true;
|
||||
}
|
||||
|
||||
protected override DeploymentParameters GetDeploymentParameters()
|
||||
{
|
||||
var deploymentParameters = base.GetDeploymentParameters();
|
||||
deploymentParameters.PublishEnvironmentVariables.Add(
|
||||
new KeyValuePair<string, string>("MvcRazorExcludeRefAssembliesFromPublish", "false"));
|
||||
|
||||
return deploymentParameters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
ClassLibraryWithPrecompiledViews.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
|
||||
<h1>Admin home page</h1>
|
||||
|
||||
|
||||
|
||||
Test section
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
ApplicationUsingRelativePaths.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
Hello from Index!
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
ApplicationUsingRelativePaths.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
Hello from Index!
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
ApplicationWithConfigureMvc.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
<br />Hello world!
|
||||
|
|
@ -1 +0,0 @@
|
|||
Hello from Test123
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
ApplicationWithRazorSdkPrecompilationUsed.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
Hello from Index!
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
|
||||
ApplicationWithRazorSdkUsed.Views, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
Hello from Index!
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title> - ApplicationWithTagHelpers</title>
|
||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css" />
|
||||
<meta name="x-stylesheet-fallback-test" content="" class="sr-only" /><script>!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("position","absolute",["\/lib\/bootstrap\/dist\/css\/bootstrap.min.css"], "rel=\u0022stylesheet\u0022 ");</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container body-content">
|
||||
|
||||
ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
<div><b>To boldy tag that no one has ever tagged before...</b></div>
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
<footer>
|
||||
<p>© 2016 - ApplicationWithTagHelpers</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title> - ApplicationWithTagHelpers</title>
|
||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css" />
|
||||
<meta name="x-stylesheet-fallback-test" content="" class="sr-only" /><script>!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("position","absolute",["\/lib\/bootstrap\/dist\/css\/bootstrap.min.css"], "rel=\u0022stylesheet\u0022 ");</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container body-content">
|
||||
|
||||
ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
<test href="/Home/About">TestTagHelper content.</test>
|
||||
|
||||
|
||||
|
||||
|
||||
<hr />
|
||||
<footer>
|
||||
<p>© 2016 - ApplicationWithTagHelpers</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
ApplicationWithTagHelpers.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
Hello world!
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css" />
|
||||
<meta name="x-stylesheet-fallback-test" content="" class="sr-only" /><script>!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("position","absolute",["\/lib\/bootstrap\/dist\/css\/bootstrap.min.css"], "rel=\u0022stylesheet\u0022 ");</script>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
Greetings Dan!
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
Greetings Dan!
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
NewAssemblyName.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
|
|
@ -1 +0,0 @@
|
|||
Hello from view in StrongNamedApp.PrecompiledViews, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
|
||||
Loading…
Reference in New Issue