Test cleanup. Fixes #3084.

Cleanup tests.
This commit is contained in:
Kevin Jones 2016-05-19 11:10:25 -04:00
parent 99d8853ef0
commit f149fe0e47
2 changed files with 39 additions and 14 deletions

View file

@ -25,19 +25,5 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
.And
.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'");
}
}
}

View file

@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.DotNet.InternalAbstractions;
using Microsoft.DotNet.ProjectModel;
@ -95,6 +96,44 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
result = testCommand.Execute($"{_projectFilePath} -o {_defaultOutputPath} --no-build");
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()
{