Add tests for invoking dotnet XX project.json from in

a folder that contains the project.
This commit is contained in:
Eric Erhardt 2016-04-26 17:22:09 -05:00
parent a070976671
commit e2dcb968eb
6 changed files with 87 additions and 0 deletions

View file

@ -103,6 +103,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-dependency-tool-invo
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Compiler.Common.Tests", "test\Microsoft.DotNet.Compiler.Common.Tests\Microsoft.DotNet.Compiler.Common.Tests.xproj", "{44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-pack.Tests", "test\dotnet-pack.Tests\dotnet-pack.Tests.xproj", "{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-run.Tests", "test\dotnet-run.Tests\dotnet-run.Tests.xproj", "{35E3C2DC-9B38-4EC5-8DD7-C32458DC485F}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Performance", "test\Performance\Performance.xproj", "{6A3095FF-A7C5-4300-85A9-C025C384401D}"
@ -727,6 +729,22 @@ Global
{44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Debug|x64.ActiveCfg = Debug|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Debug|x64.Build.0 = Debug|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.MinSizeRel|x64.Build.0 = Debug|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Release|Any CPU.Build.0 = Release|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Release|x64.ActiveCfg = Release|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.Release|x64.Build.0 = Release|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
{35E3C2DC-9B38-4EC5-8DD7-C32458DC485F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35E3C2DC-9B38-4EC5-8DD7-C32458DC485F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35E3C2DC-9B38-4EC5-8DD7-C32458DC485F}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -807,6 +825,7 @@ Global
{1AB5B24B-B317-4142-A5D1-A6E84F15BA34} = {ADA7052B-884B-4776-8B8D-D04191D0AA70}
{C26A48BB-193F-450C-AB09-4D3324C78188} = {1AB5B24B-B317-4142-A5D1-A6E84F15BA34}
{44E7D1AC-DCF1-4A18-9C22-F09E6BB302B5} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{5FDA6D37-3A3E-4333-BA5C-F0B28BE316F4} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{35E3C2DC-9B38-4EC5-8DD7-C32458DC485F} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
{6A3095FF-A7C5-4300-85A9-C025C384401D} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
EndGlobalSection

View file

@ -43,6 +43,20 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
.Pass();
}
[Fact]
public void It_builds_projects_with_a_local_project_json_path()
{
var testInstance = TestAssetsManager
.CreateTestInstance("TestAppSimple")
.WithLockFiles();
new BuildCommand("project.json")
.WithWorkingDirectory(testInstance.TestRoot)
.ExecuteWithCapturedOutput()
.Should()
.Pass();
}
[Fact]
public void It_builds_projects_with_xmlDoc_and_spaces_in_the_path()
{

View file

@ -136,6 +136,20 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
zip.Entries.Should().Contain(e => e.FullName == "lib/netstandard1.5/MyLibrary.pdb");
}
[Fact]
public void PackWorksWithLocalProjectJson()
{
var testInstance = TestAssetsManager
.CreateTestInstance("TestAppSimple")
.WithLockFiles();
new PackCommand(Project.FileName)
.WithWorkingDirectory(testInstance.TestRoot)
.Execute()
.Should()
.Pass();
}
private void CopyProjectToTempDir(string projectDir, TempDirectory tempDir)
{
// copy all the files to temp dir

View file

@ -360,5 +360,18 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
command.Execute($"publish {temp}").Should().Fail();
}
}
[Fact]
public void PublishWorksWithLocalProjectJson()
{
TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppSimple")
.WithLockFiles();
new PublishCommand("project.json")
.WithWorkingDirectory(instance.TestRoot)
.Execute()
.Should()
.Pass();
}
}
}

View file

@ -68,6 +68,21 @@ namespace Microsoft.DotNet.Tools.Run.Tests
new RunCommand(instance.TestRoot).Execute().Should().Pass();
}
[Fact]
public void ItRunsWithLocalProjectJsonArg()
{
TestInstance instance = TestAssetsManager.CreateTestInstance("TestAppSimple")
.WithLockFiles()
.WithBuildArtifacts();
new RunCommand("project.json")
.WithWorkingDirectory(instance.TestRoot)
.ExecuteWithCapturedOutput()
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World!");
}
[Fact]
public void ItRunsAppsThatOutputUnicodeCharacters()
{

View file

@ -55,6 +55,18 @@ namespace Microsoft.Dotnet.Tools.Test.Tests
result.Should().Pass();
}
[Fact]
public void It_runs_tests_for_a_local_project_json()
{
string projectDirectory = Path.GetDirectoryName(_projectFilePath);
new DotnetTestCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("project.json")
.Should()
.Pass();
}
[Fact]
public void It_builds_the_project_using_the_output_passed()
{