merge master
This commit is contained in:
parent
3ce1b9f0b7
commit
c85492bd48
21 changed files with 412 additions and 93 deletions
|
@ -0,0 +1,19 @@
|
|||
// 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 Microsoft.DotNet.PlatformAbstractions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public class LinuxOnlyFactAttribute : FactAttribute
|
||||
{
|
||||
public LinuxOnlyFactAttribute()
|
||||
{
|
||||
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Linux)
|
||||
{
|
||||
this.Skip = "This test requires linux to run";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
// 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 Microsoft.DotNet.PlatformAbstractions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public class MacOsOnlyFactAttribute : FactAttribute
|
||||
{
|
||||
public MacOsOnlyFactAttribute()
|
||||
{
|
||||
if (RuntimeEnvironment.OperatingSystemPlatform != Platform.Darwin)
|
||||
{
|
||||
this.Skip = "This test requires macos to run";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ using Microsoft.Build.Construction;
|
|||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
using FluentAssertions;
|
||||
using HelpActual = Microsoft.DotNet.Tools.Help;
|
||||
|
||||
namespace Microsoft.DotNet.Help.Tests
|
||||
{
|
||||
|
@ -65,5 +66,40 @@ Advanced Commands:
|
|||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().ContainVisuallySameFragment(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenInvalidCommandIsPassedToDotnetHelpItPrintsError()
|
||||
{
|
||||
var cmd = new DotnetCommand()
|
||||
.ExecuteWithCapturedOutput("help invalid");
|
||||
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().ContainVisuallySameFragment($"Specified command 'invalid' is not a valid CLI command. Please specify a valid CLI commands. For more information, run dotnet help.");
|
||||
cmd.StdOut.Should().ContainVisuallySameFragment(HelpText);
|
||||
}
|
||||
|
||||
[WindowsOnlyFact]
|
||||
public void WhenRunOnWindowsDotnetHelpCommandShouldContainProperProcessInformation()
|
||||
{
|
||||
var proc = HelpActual.HelpCommand.ConfigureProcess("https://aka.ms/dotnet-build");
|
||||
Assert.Equal("cmd", proc.StartInfo.FileName);
|
||||
Assert.Equal("/c start https://aka.ms/dotnet-build", proc.StartInfo.Arguments);
|
||||
}
|
||||
|
||||
[LinuxOnlyFact]
|
||||
public void WhenRunOnLinuxDotnetHelpCommandShouldContainProperProcessInformation()
|
||||
{
|
||||
var proc = HelpActual.HelpCommand.ConfigureProcess("https://aka.ms/dotnet-build");
|
||||
Assert.Equal("xdg-open", proc.StartInfo.FileName);
|
||||
Assert.Equal("https://aka.ms/dotnet-build", proc.StartInfo.Arguments);
|
||||
|
||||
}
|
||||
[MacOsOnlyFact]
|
||||
public void WhenRunOnMacOsDotnetHelpCommandShouldContainProperProcessInformation()
|
||||
{
|
||||
var proc = HelpActual.HelpCommand.ConfigureProcess("https://aka.ms/dotnet-build");
|
||||
Assert.Equal("open", proc.StartInfo.FileName);
|
||||
Assert.Equal("https://aka.ms/dotnet-build", proc.StartInfo.Arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue