Add self-contained end-to-end coverage
Also, re-enable skipped test and remove unnecessary workarounds
This commit is contained in:
parent
48f4f207ea
commit
421ec230d0
1 changed files with 24 additions and 37 deletions
|
@ -2,16 +2,15 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using Microsoft.DotNet.PlatformAbstractions;
|
||||||
using Microsoft.DotNet.TestFramework;
|
using Microsoft.DotNet.TestFramework;
|
||||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace EndToEnd.Tests
|
namespace EndToEnd.Tests
|
||||||
{
|
{
|
||||||
|
|
||||||
public class ProjectBuildTests : TestBase
|
public class ProjectBuildTests : TestBase
|
||||||
{
|
{
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ItCanNewRestoreBuildRunCleanMSBuildProject()
|
public void ItCanNewRestoreBuildRunCleanMSBuildProject()
|
||||||
{
|
{
|
||||||
|
@ -35,18 +34,8 @@ namespace EndToEnd.Tests
|
||||||
.Should().Pass();
|
.Should().Pass();
|
||||||
|
|
||||||
var runCommand = new RunCommand()
|
var runCommand = new RunCommand()
|
||||||
.WithWorkingDirectory(projectDirectory);
|
.WithWorkingDirectory(projectDirectory)
|
||||||
|
.ExecuteWithCapturedOutput()
|
||||||
// Set DOTNET_ROOT as workaround for https://github.com/dotnet/cli/issues/10196
|
|
||||||
var dotnetRoot = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest);
|
|
||||||
if (!string.IsNullOrEmpty(dotnetRoot))
|
|
||||||
{
|
|
||||||
bool useX86 = RepoDirectoriesProvider.DotnetRidUnderTest.EndsWith("x86", StringComparison.InvariantCultureIgnoreCase);
|
|
||||||
runCommand = runCommand.WithEnvironmentVariable(useX86 ? "DOTNET_ROOT(x86)" : "DOTNET_ROOT",
|
|
||||||
dotnetRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
runCommand.ExecuteWithCapturedOutput()
|
|
||||||
.Should().Pass()
|
.Should().Pass()
|
||||||
.And.HaveStdOutContaining("Hello World!");
|
.And.HaveStdOutContaining("Hello World!");
|
||||||
|
|
||||||
|
@ -61,7 +50,7 @@ namespace EndToEnd.Tests
|
||||||
binDirectory.Should().NotHaveFilesMatching("*.dll", SearchOption.AllDirectories);
|
binDirectory.Should().NotHaveFilesMatching("*.dll", SearchOption.AllDirectories);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact(Skip = "Need support for ASP.NET on .NET Core 3.1")]
|
[Fact]
|
||||||
public void ItCanRunAnAppUsingTheWebSdk()
|
public void ItCanRunAnAppUsingTheWebSdk()
|
||||||
{
|
{
|
||||||
var directory = TestAssets.CreateTestDirectory();
|
var directory = TestAssets.CreateTestDirectory();
|
||||||
|
@ -88,21 +77,10 @@ namespace EndToEnd.Tests
|
||||||
.Should().Pass();
|
.Should().Pass();
|
||||||
|
|
||||||
var runCommand = new RunCommand()
|
var runCommand = new RunCommand()
|
||||||
.WithWorkingDirectory(projectDirectory);
|
.WithWorkingDirectory(projectDirectory)
|
||||||
|
.ExecuteWithCapturedOutput()
|
||||||
// Set DOTNET_ROOT as workaround for https://github.com/dotnet/cli/issues/10196
|
|
||||||
var dotnetRoot = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest);
|
|
||||||
if (!string.IsNullOrEmpty(dotnetRoot))
|
|
||||||
{
|
|
||||||
bool useX86 = RepoDirectoriesProvider.DotnetRidUnderTest.EndsWith("x86", StringComparison.InvariantCultureIgnoreCase);
|
|
||||||
runCommand = runCommand.WithEnvironmentVariable(useX86 ? "DOTNET_ROOT(x86)" : "DOTNET_ROOT",
|
|
||||||
dotnetRoot);
|
|
||||||
}
|
|
||||||
|
|
||||||
runCommand.ExecuteWithCapturedOutput()
|
|
||||||
.Should().Pass()
|
.Should().Pass()
|
||||||
.And.HaveStdOutContaining("Hello World!");
|
.And.HaveStdOutContaining("Hello World!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
@ -125,7 +103,22 @@ namespace EndToEnd.Tests
|
||||||
TestTemplateBuild(templateName);
|
TestTemplateBuild(templateName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TestTemplateBuild(string templateName)
|
[WindowsOnlyTheory]
|
||||||
|
[InlineData("wpf")]
|
||||||
|
public void ItCanBuildDesktopTemplatesSelfContained(string templateName)
|
||||||
|
{
|
||||||
|
TestTemplateBuild(templateName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData("web")]
|
||||||
|
[InlineData("console")]
|
||||||
|
public void ItCanBuildTemplatesSelfContained(string templateName)
|
||||||
|
{
|
||||||
|
TestTemplateBuild(templateName, selfContained: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TestTemplateBuild(string templateName, bool selfContained = false)
|
||||||
{
|
{
|
||||||
var directory = TestAssets.CreateTestDirectory(identifier: templateName);
|
var directory = TestAssets.CreateTestDirectory(identifier: templateName);
|
||||||
string projectDirectory = directory.FullName;
|
string projectDirectory = directory.FullName;
|
||||||
|
@ -136,18 +129,12 @@ namespace EndToEnd.Tests
|
||||||
.Execute(newArgs)
|
.Execute(newArgs)
|
||||||
.Should().Pass();
|
.Should().Pass();
|
||||||
|
|
||||||
// Work-around for MVC template test until ASP.Net publishes Preview 5 'Microsoft.AspNetCore.Mvc.NewtonsoftJson' to NuGet.org
|
var buildArgs = selfContained ? "" :$"-r {RuntimeEnvironment.GetRuntimeIdentifier()}";
|
||||||
string restoreArgs = string.Equals(templateName, "mvc", StringComparison.OrdinalIgnoreCase) ? "/p:RestoreAdditionalProjectSources=https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json" : "";
|
|
||||||
new RestoreCommand()
|
|
||||||
.WithWorkingDirectory(projectDirectory)
|
|
||||||
.Execute(restoreArgs)
|
|
||||||
.Should().Pass();
|
|
||||||
|
|
||||||
var dotnetRoot = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest);
|
var dotnetRoot = Path.GetDirectoryName(RepoDirectoriesProvider.DotnetUnderTest);
|
||||||
new BuildCommand()
|
new BuildCommand()
|
||||||
.WithEnvironmentVariable("PATH", dotnetRoot) // override PATH since razor rely on PATH to find dotnet
|
.WithEnvironmentVariable("PATH", dotnetRoot) // override PATH since razor rely on PATH to find dotnet
|
||||||
.WithWorkingDirectory(projectDirectory)
|
.WithWorkingDirectory(projectDirectory)
|
||||||
.Execute()
|
.Execute(buildArgs)
|
||||||
.Should().Pass();
|
.Should().Pass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue