2016-03-02 01:42:44 +00:00
|
|
|
|
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()
|
|
|
|
|
{
|
2016-03-09 19:36:16 +00:00
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests")
|
2016-03-02 01:42:44 +00:00
|
|
|
|
.WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var result = new BuildCommand(
|
2016-03-09 19:36:16 +00:00
|
|
|
|
projectPath: Path.Combine(testInstance.TestRoot, "PortableApp"),
|
2016-03-02 01:42:44 +00:00
|
|
|
|
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()
|
|
|
|
|
{
|
2016-03-09 19:36:16 +00:00
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests")
|
2016-03-02 01:42:44 +00:00
|
|
|
|
.WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var result = new BuildCommand(
|
2016-03-09 19:36:16 +00:00
|
|
|
|
projectPath: Path.Combine(testInstance.TestRoot, "PortableApp"),
|
2016-03-02 01:42:44 +00:00
|
|
|
|
output: Path.Combine(testInstance.TestRoot, "out"),
|
|
|
|
|
framework: "sl40")
|
|
|
|
|
.ExecuteWithCapturedOutput();
|
|
|
|
|
|
|
|
|
|
result.Should().Fail();
|
2016-04-20 02:14:59 +00:00
|
|
|
|
result.Should().HaveStdErrMatching("Project '.*?' does not support framework: Silverlight,Version=v4\\.0\\.");
|
2016-03-02 01:42:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ErrorOccursWhenBuildingStandaloneProjectToSpecificOutputPathWithoutSpecifyingFramework()
|
|
|
|
|
{
|
2016-03-09 19:36:16 +00:00
|
|
|
|
var testInstance = TestAssetsManager.CreateTestInstance("PortableTests")
|
2016-03-02 01:42:44 +00:00
|
|
|
|
.WithLockFiles();
|
|
|
|
|
|
|
|
|
|
var result = new BuildCommand(
|
2016-03-09 19:36:16 +00:00
|
|
|
|
projectPath: Path.Combine(testInstance.TestRoot, "StandaloneApp"),
|
2016-03-02 01:42:44 +00:00
|
|
|
|
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.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|