Fixing #2480 to produce an InvalidProjectException when attempting to publish a

project folder that does not contain a project.json file
This commit is contained in:
Jonathan Miller 2016-04-15 15:30:16 -07:00
parent ef982d120e
commit a71e4a5128
4 changed files with 45 additions and 0 deletions

View file

@ -294,5 +294,26 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
var command = new TestCommand(Path.Combine(publishedDir.FullName, outputExe));
command.Execute("").Should().ExitWith(0);
}
[Fact]
public void PublishFailsWhenProjectRootIsEmpty()
{
using (var dir = new DisposableDirectory(Temp))
{
var command = new TestCommand("dotnet");
command.Execute($"publish {dir.Path}").Should().Fail();
}
}
[Fact]
public void PublishFailsWhenProjectJsonDoesNotExist()
{
using (var dir = new DisposableDirectory(Temp))
{
var command = new TestCommand("dotnet");
string temp = Path.Combine(dir.Path, "project.json");
command.Execute($"publish {temp}").Should().Fail();
}
}
}
}