dotnet-installer/test/dotnet-build.Tests/BuildInvalidArgumentsTests.cs

56 lines
2.2 KiB
C#
Raw Normal View History

using System.IO;
using Microsoft.DotNet.Tools.Test.Utilities;
using Xunit;
namespace Microsoft.DotNet.Tools.Builder.Tests
{
public class BuildInvalidArgumentsTests : TestBase
{
[Fact]
public void ErrorOccursWhenBuildingPortableProjectToSpecificOutputPathWithoutSpecifyingFramework()
{
var testInstance = TestAssetsManager.CreateTestInstance("BuildTestPortableProject")
.WithLockFiles();
var result = new BuildCommand(
projectPath: testInstance.TestRoot,
output: Path.Combine(testInstance.TestRoot, "out"))
.ExecuteWithCapturedOutput();
result.Should().Fail();
result.Should().HaveStdErrContaining("When the '--output' option is provided, the '--framework' option must also be provided.");
}
[Fact]
public void ErrorOccursWhenBuildingPortableProjectAndSpecifyingFrameworkThatProjectDoesNotSupport()
{
var testInstance = TestAssetsManager.CreateTestInstance("BuildTestPortableProject")
.WithLockFiles();
var result = new BuildCommand(
projectPath: testInstance.TestRoot,
output: Path.Combine(testInstance.TestRoot, "out"),
framework: "sl40")
.ExecuteWithCapturedOutput();
result.Should().Fail();
result.Should().HaveStdErrContaining("Project does not support framework: Silverlight,Version=v4.0.");
}
[Fact]
public void ErrorOccursWhenBuildingStandaloneProjectToSpecificOutputPathWithoutSpecifyingFramework()
{
var testInstance = TestAssetsManager.CreateTestInstance("BuildTestStandaloneProject")
.WithLockFiles();
var result = new BuildCommand(
projectPath: testInstance.TestRoot,
output: Path.Combine(testInstance.TestRoot, "out"))
.ExecuteWithCapturedOutput();
result.Should().Fail();
result.Should().HaveStdErrContaining("When the '--output' option is provided, the '--framework' option must also be provided.");
}
}
}