parent
99d8853ef0
commit
f149fe0e47
2 changed files with 39 additions and 14 deletions
|
@ -25,19 +25,5 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
|
||||||
.And
|
.And
|
||||||
.HaveStdErrContaining("dotnet restore");
|
.HaveStdErrContaining("dotnet restore");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void It_fails_correctly_with_invalid_runtime_parameter()
|
|
||||||
{
|
|
||||||
var instance = TestAssetsManager.CreateTestInstance(Path.Combine("ProjectsWithTests", "NetCoreAppOnlyProject"));
|
|
||||||
|
|
||||||
new DotnetTestCommand()
|
|
||||||
.WithLockFiles()
|
|
||||||
.ExecuteWithCapturedOutput(instance.TestRoot)
|
|
||||||
.Should()
|
|
||||||
.Fail()
|
|
||||||
.And
|
|
||||||
.HaveStdErrContaining("Missing value for option 'runtime'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.DotNet.InternalAbstractions;
|
using Microsoft.DotNet.InternalAbstractions;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
|
@ -96,6 +97,44 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
|
||||||
result.Should().Pass();
|
result.Should().Pass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[MemberData("ArgumentNames")]
|
||||||
|
public void It_fails_correctly_with_unspecified_arguments_with_long_form(string argument)
|
||||||
|
{
|
||||||
|
new DotnetTestCommand()
|
||||||
|
.ExecuteWithCapturedOutput($"{_projectFilePath} --{argument}")
|
||||||
|
.Should()
|
||||||
|
.Fail()
|
||||||
|
.And
|
||||||
|
.HaveStdErrContaining($"Missing value for option '{argument}'");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[MemberData("ArgumentNames")]
|
||||||
|
public void It_fails_correctly_with_unspecified_arguments_with_short_form(string argument)
|
||||||
|
{
|
||||||
|
new DotnetTestCommand()
|
||||||
|
.ExecuteWithCapturedOutput($"{_projectFilePath} -{argument[0]}")
|
||||||
|
.Should()
|
||||||
|
.Fail()
|
||||||
|
.And
|
||||||
|
.HaveStdErrContaining($"Missing value for option '{argument}'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<object[]> ArgumentNames
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new object[] { "output" },
|
||||||
|
new object[] { "configuration" },
|
||||||
|
new object[] { "runtime" },
|
||||||
|
new object[] { "build-base-path" }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string GetNotSoLongBuildBasePath()
|
private string GetNotSoLongBuildBasePath()
|
||||||
{
|
{
|
||||||
return Path.GetFullPath(
|
return Path.GetFullPath(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue