make GivenDotnetUsesDotnetTools test optional based on AspNetCore availability (#207)
This commit is contained in:
parent
4538e052e4
commit
e1e6c25c1b
3 changed files with 29 additions and 1 deletions
|
@ -6,7 +6,7 @@ namespace EndToEnd
|
|||
{
|
||||
public class GivenDotnetUsesDotnetTools : TestBase
|
||||
{
|
||||
[Fact]
|
||||
[RequiresAspNetCore]
|
||||
public void ThenOneDotnetToolsCanBeCalled()
|
||||
{
|
||||
new DotnetCommand()
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
private string _builtDotnet;
|
||||
private string _nugetPackages;
|
||||
private string _stage2Sdk;
|
||||
private string _stage2AspNetCore;
|
||||
private string _stage2WithBackwardsCompatibleRuntimesDirectory;
|
||||
private string _testPackages;
|
||||
private string _testWorkingFolder;
|
||||
|
@ -90,6 +91,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
public string DotnetRoot => _dotnetRoot;
|
||||
public string NugetPackages => _nugetPackages;
|
||||
public string Stage2Sdk => _stage2Sdk;
|
||||
public string Stage2AspNetCore => _stage2AspNetCore;
|
||||
public string Stage2WithBackwardsCompatibleRuntimesDirectory => _stage2WithBackwardsCompatibleRuntimesDirectory;
|
||||
public string TestPackages => _testPackages;
|
||||
public string TestWorkingFolder => _testWorkingFolder;
|
||||
|
@ -116,6 +118,12 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
|||
.EnumerateDirectories(Path.Combine(_artifacts, "dotnet", "sdk"))
|
||||
.First(d => !d.Contains("NuGetFallbackFolder"));
|
||||
|
||||
string AspNetCoreDir = Path.Combine(_dotnetRoot, "shared", "Microsoft.AspNetCore.App");
|
||||
if (Directory.Exists(AspNetCoreDir))
|
||||
{
|
||||
_stage2AspNetCore = Directory.EnumerateDirectories(AspNetCoreDir).First();
|
||||
}
|
||||
|
||||
_stage2WithBackwardsCompatibleRuntimesDirectory =
|
||||
Path.Combine(_artifacts, "dotnetWithBackwardsCompatibleRuntimes");
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public class RequiresAspNetCore : FactAttribute
|
||||
{
|
||||
public RequiresAspNetCore()
|
||||
{
|
||||
var repoDirectoriesProvider = new RepoDirectoriesProvider();
|
||||
|
||||
if (repoDirectoriesProvider.Stage2AspNetCore == null)
|
||||
{
|
||||
this.Skip = $"This test requires a AspNetCore but it isn't present.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue