Adding a test that verifies that running dotnet migrate solution.sln will only migrate the projects in the solution file.

This commit is contained in:
Livar Cunha 2017-01-19 13:59:31 -08:00
parent 6568113e34
commit dbf4b5de77
3 changed files with 56 additions and 0 deletions

View file

@ -0,0 +1,12 @@
using System;
namespace App.Tests
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,15 @@
{
"frameworks": {
"netcoreapp1.0": {
"imports": [
"portable-net451+win8"
],
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
}
}
}
}

View file

@ -51,6 +51,35 @@ namespace Microsoft.DotNet.Migration.Tests
"PJAppWithSlnAndXprojRefs");
}
[Fact]
public void ItOnlyMigratesProjectsInTheSlnFile()
{
var projectDirectory = TestAssets
.Get("NonRestoredTestProjects", "PJAppWithSlnAndXprojRefs")
.CreateInstance()
.WithSourceFiles()
.Root;
var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute($"migrate \"{solutionRelPath}\"")
.Should().Pass();
new DirectoryInfo(projectDirectory.FullName)
.Should().HaveFiles(new []
{
Path.Combine("TestApp", "TestApp.csproj"),
Path.Combine("TestLibrary", "TestLibrary.csproj"),
Path.Combine("TestApp", "src", "subdir", "subdir.csproj"),
Path.Combine("TestApp", "TestAssets", "TestAsset", "project.json")
});
new DirectoryInfo(projectDirectory.FullName)
.Should().NotHaveFile(Path.Combine("TestApp", "TestAssets", "TestAsset", "TestAsset.csproj"));
}
[Fact]
public void WhenDirectoryAlreadyContainsCsprojFileItMigratesAndBuildsSln()
{