示例#1
0
        public void MigratingDeprecatedResourceBuiltIn()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedResourceBuiltIn")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .Root
                                   .GetDirectory("project");

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("migrate")
            .Should().Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("restore")
            .Should().Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("build -c Debug")
            .Should().Pass();

            var cmd = new DotnetCommand()
                      .WithWorkingDirectory(projectDirectory)
                      .ExecuteWithCapturedOutput("run -c Debug");

            cmd.Should().Pass();
            // Issue: https://github.com/dotnet/cli/issues/5467
            //cmd.StdOut.Should().Contain("2 Resources Found:");
        }
示例#2
0
        public void MigratingDeprecatedCompileBuiltIn()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompileBuiltIn")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .Root
                                   .GetDirectory("project");

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("migrate")
            .Should().Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("restore")
            .Should().Pass();

            //Issue: https://github.com/dotnet/cli/issues/5467
            //new DotnetCommand()
            //     .WithWorkingDirectory(projectDirectory)
            //     .Execute("build -c Debug")
            //     .Should().Pass();
        }
示例#3
0
        public void WhenFolderMigrationSucceedsThenProjectJsonArtifactsGetMovedToBackup(string testProjectName)
        {
            var testRoot = TestAssets
                           .GetProjectJson(testProjectName)
                           .CreateInstance()
                           .WithSourceFiles()
                           .Root;

            var backupRoot = testRoot.GetDirectory("backup");

            var migratableArtifacts = GetProjectJsonArtifacts(testRoot);

            new MigrateCommand()
            .WithWorkingDirectory(testRoot)
            .Execute()
            .Should().Pass();

            var backupArtifacts = GetProjectJsonArtifacts(backupRoot);

            backupArtifacts.Should().Equal(migratableArtifacts, "Because all of and only these artifacts should have been moved");

            testRoot.Should().NotHaveFiles(backupArtifacts.Keys);

            backupRoot.Should().HaveTextFiles(backupArtifacts);
        }
示例#4
0
        public void WhenMigratingDeprecatedPackOptionsWarningsArePrinted()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedPack")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .Root;

            var cmd = new DotnetCommand()
                      .WithWorkingDirectory(projectDirectory)
                      .ExecuteWithCapturedOutput("migrate");

            cmd.Should().Pass();

            cmd.StdOut.Should().Contain(
                "The 'repository' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'projectUrl' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'licenseUrl' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'iconUrl' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'owners' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'tags' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'releaseNotes' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'requireLicenseAcceptance' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'summary' option in the root is deprecated. Use it in 'packOptions' instead.");
            cmd.StdOut.Should().Contain(
                "The 'packInclude' option is deprecated. Use 'files' in 'packOptions' instead.");
        }
示例#5
0
        public void ItMigratesAllProjectsInGivenDirectory(bool skipRefs)
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("TestAppDependencyGraph")
                                   .CreateInstance(callingMethod: $"MigrateDirectory.SkipRefs.{skipRefs}")
                                   .WithSourceFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            if (skipRefs)
            {
                MigrateProject(new[] { projectDirectory.FullName, "--skip-project-references" });
            }
            else
            {
                MigrateProject(new[] { projectDirectory.FullName });
            }

            string[] migratedProjects = new string[]
            {
                "ProjectA", "ProjectB", "ProjectC", "ProjectD", "ProjectE", "ProjectF", "ProjectG", "ProjectH",
                "ProjectI", "ProjectJ"
            };

            VerifyMigration(migratedProjects, projectDirectory);
        }
示例#6
0
        public void WhenUsingGlobalJsonItOnlyMigratesProjectsInTheGlobalJsonNode()
        {
            var solutionDirectory = TestAssets
                                    .GetProjectJson("AppWithPackageNamedAfterFolder")
                                    .CreateInstance()
                                    .WithSourceFiles()
                                    .Root;

            var globalJsonPath = solutionDirectory.GetFile("global.json");

            new TestCommand("dotnet")
            .WithForwardingToConsole()
            .Execute($"migrate {globalJsonPath.FullName}")
            .Should()
            .Pass();

            solutionDirectory
            .Should().HaveFiles(new []
            {
                Path.Combine("src", "App", "App.csproj"),
                Path.Combine("test", "App.Tests", "App.Tests.csproj"),
                Path.Combine("TestAssets", "TestAsset", "project.json")
            });

            solutionDirectory
            .Should().NotHaveFile(Path.Combine("TestAssets", "TestAsset", "TestAsset.csproj"));
        }
示例#7
0
        public void MigratingDeprecatedCompileExclude()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompileExclude")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .Root;

            new MigrateTestCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute()
            .Should()
            .Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("restore")
            .Should()
            .Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("build -c Debug")
            .Should()
            .Pass();
        }
        public void ItPacksContentForLibraries()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("PJTestLibraryWithConfiguration")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            new TestCommand("dotnet")
            .WithForwardingToConsole()
            .Execute($"migrate {projectDirectory.FullName}")
            .Should()
            .Pass();

            var command = new RestoreCommand()
                          .WithWorkingDirectory(projectDirectory)
                          .Execute()
                          .Should()
                          .Pass();

            var result = new PackCommand()
                         .WithWorkingDirectory(projectDirectory)
                         .ExecuteWithCapturedOutput()
                         .Should()
                         .Pass();

            using (var archive = ZipFile.OpenRead(
                       Path.Combine(projectDirectory.FullName, "bin", "debug", "PJTestLibraryWithConfiguration.1.0.0.nupkg")))
            {
                archive.Entries.Select(e => e.FullName).Should().Contain("dir/contentitem.txt");
            }
        }
        public void ItOnlyMigratesProjectsInTheSlnFile()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndXprojRefs")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");

            new MigrateTestCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute($"\"{solutionRelPath}\"")
            .Should()
            .Pass();

            projectDirectory
            .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")
            });

            projectDirectory
            .Should()
            .NotHaveFile(Path.Combine("TestApp", "TestAssets", "TestAsset", "TestAsset.csproj"));
        }
示例#10
0
        public void WhenMigratingDeprecatedContentOptionsWarningsArePrinted()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedContent")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .Root;

            var cmd = new MigrateTestCommand()
                      .WithWorkingDirectory(projectDirectory)
                      .ExecuteWithCapturedOutput();

            cmd.Should().Pass();

            cmd.StdOut.Should()
            .Contain(
                "The 'content' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead.");
            cmd.StdOut.Should()
            .Contain(
                "The 'contentExclude' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead.");
            cmd.StdOut.Should()
            .Contain(
                "The 'contentFiles' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead.");
            cmd.StdOut.Should()
            .Contain(
                "The 'contentBuiltIn' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead.");
        }
        public void ItMigratesSlnAndEnsuresAtLeastVS15(
            string projectName,
            string productDescription,
            string visualStudioVersion,
            string minVisualStudioVersion)
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, projectName)
                                   .CreateInstance(identifier: projectName)
                                   .WithSourceFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            var solutionRelPath = "TestApp.sln";

            new MigrateTestCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute($"\"{solutionRelPath}\"")
            .Should()
            .Pass();

            SlnFile slnFile = SlnFile.Read(Path.Combine(projectDirectory.FullName, solutionRelPath));

            slnFile.ProductDescription.Should().Be(productDescription);
            slnFile.VisualStudioVersion.Should().Be(visualStudioVersion);
            slnFile.MinimumVisualStudioVersion.Should().Be(minVisualStudioVersion);
        }
        public void WhenMigratingAnSlnLinksReferencingItemsMovedToBackupAreRemoved(
            string slnFileName,
            bool solutionItemsContainsReadme)
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithSlnAndSolutionItemsToMoveToBackup")
                                   .CreateInstance(Path.GetFileNameWithoutExtension(slnFileName))
                                   .WithSourceFiles()
                                   .Root
                                   .FullName;

            new MigrateTestCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute($"\"{slnFileName}\"")
            .Should()
            .Pass();

            var slnFile         = SlnFile.Read(Path.Combine(projectDirectory, slnFileName));
            var solutionFolders = slnFile.Projects.Where(p => p.TypeGuid == ProjectTypeGuids.SolutionFolderGuid);

            if (solutionItemsContainsReadme)
            {
                solutionFolders.Count().Should().Be(1);
                var solutionItems = solutionFolders.Single().Sections.GetSection("SolutionItems");
                solutionItems.Should().NotBeNull();
                solutionItems.Properties.Count().Should().Be(1);
                solutionItems.Properties["readme.txt"].Should().Be("readme.txt");
            }
            else
            {
                solutionFolders.Count().Should().Be(0);
            }
        }
        public void WhenSolutionContainsACsprojFileItGetsMovedToBackup()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("NonRestoredTestProjects", "PJAppWithSlnAndOneAlreadyMigratedCsproj")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            var solutionRelPath = Path.Combine("TestApp", "TestApp.sln");

            var cmd = new MigrateTestCommand()
                      .WithWorkingDirectory(projectDirectory)
                      .Execute($"\"{solutionRelPath}\"");

            cmd.Should().Pass();

            projectDirectory
            .GetDirectory("TestLibrary")
            .GetFile("TestLibrary.csproj")
            .Should()
            .Exist();

            projectDirectory
            .GetDirectory("TestLibrary")
            .GetFile("TestLibrary.csproj.migration_in_place_backup")
            .Should()
            .NotExist();

            projectDirectory
            .GetDirectory("backup", "TestLibrary")
            .GetFile("TestLibrary.csproj")
            .Should()
            .Exist();
        }
        public void ItMigratesALibrary(string projectName)
        {
            // running into https://github.com/dotnet/coreclr/issues/9118 with crossgen'd csc on non-Windows
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && projectName == "TestLibraryWithAnalyzer")
            {
                return;
            }

            var projectDirectory = TestAssets
                                   .GetProjectJson(projectName)
                                   .CreateInstance(identifier: projectName)
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .Root;

            var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(
                projectDirectory,
                Path.GetFileNameWithoutExtension(projectName));

            var outputsIdentical = outputComparisonData
                                   .ProjectJsonBuildOutputs
                                   .SetEquals(outputComparisonData.MSBuildBuildOutputs);

            if (!outputsIdentical)
            {
                OutputDiagnostics(outputComparisonData);
            }

            outputsIdentical.Should().BeTrue();
        }
示例#15
0
        public void ItHasWarningWhenMigratingADeprecatedProjectJson()
        {
            var testProjectDirectory = TestAssets
                                       .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedCompile")
                                       .CreateInstance()
                                       .WithSourceFiles()
                                       .Root
                                       .GetDirectory("project")
                                       .FullName;

            var mockProj     = ProjectRootElement.Create();
            var testSettings = MigrationSettings.CreateMigrationSettingsTestHook(
                testProjectDirectory,
                testProjectDirectory,
                mockProj);

            var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule());
            var report          = projectMigrator.Migrate(testSettings);

            var projectReport  = report.ProjectMigrationReports.First();
            var warningMessage = projectReport.Warnings.First();

            warningMessage.Should().Contain("MIGRATE1011::Deprecated Project:");
            warningMessage.Should().Contain("The 'compile' option is deprecated. Use 'compile' in 'buildOptions' instead. (line: 3, file:");
        }
示例#16
0
        public void ItMigratesSignedApps()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("TestAppWithSigning")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            CleanBinObj(projectDirectory);

            var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, "TestAppWithSigning");

            var outputsIdentical =
                outputComparisonData.ProjectJsonBuildOutputs.SetEquals(outputComparisonData.MSBuildBuildOutputs);

            if (!outputsIdentical)
            {
                OutputDiagnostics(outputComparisonData);
            }

            outputsIdentical.Should().BeTrue();

            VerifyAllMSBuildOutputsRunnable(projectDirectory);

            VerifyAllMSBuildOutputsAreSigned(projectDirectory);
        }
示例#17
0
        // regression test for https://github.com/dotnet/cli/issues/4269
        public void ItMigratesAndBuildsP2PReferences()
        {
            var assetsDir = TestAssets
                            .GetProjectJson("TestAppDependencyGraph")
                            .CreateInstance()
                            .WithSourceFiles()
                            .WithRestoreFiles()
                            .WithEmptyGlobalJson()
                            .Root;

            var projectDirectory = assetsDir.GetDirectory("ProjectF");

            var restoreDirectories = new DirectoryInfo[]
            {
                projectDirectory,
                assetsDir.GetDirectory("ProjectG")
            };

            var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, "ProjectF", new [] { projectDirectory.FullName }, restoreDirectories);

            var outputsIdentical = outputComparisonData.ProjectJsonBuildOutputs
                                   .SetEquals(outputComparisonData.MSBuildBuildOutputs);

            if (!outputsIdentical)
            {
                OutputDiagnostics(outputComparisonData);
            }

            outputsIdentical.Should().BeTrue();

            VerifyAllMSBuildOutputsRunnable(projectDirectory);
        }
示例#18
0
        public void MigratingDeprecatedResourceExclude()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedResourceExclude")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .Root;

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("migrate")
            .Should().Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("restore")
            .Should().Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("build -c Debug")
            .Should().Pass();

            var cmd = new DotnetCommand()
                      .WithWorkingDirectory(projectDirectory)
                      .ExecuteWithCapturedOutput("run -c Debug");

            cmd.Should().Pass();
            cmd.StdOut.Should().Contain("0 Resources Found:");
        }
示例#19
0
        public void ItMigratesALibrary(string projectName)
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(projectName)
                                   .CreateInstance(identifier: projectName)
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(
                projectDirectory,
                Path.GetFileNameWithoutExtension(projectName));

            var outputsIdentical = outputComparisonData
                                   .ProjectJsonBuildOutputs
                                   .SetEquals(outputComparisonData.MSBuildBuildOutputs);

            if (!outputsIdentical)
            {
                OutputDiagnostics(outputComparisonData);
            }

            outputsIdentical.Should().BeTrue();
        }
示例#20
0
        public void ItMigratesApps(string projectName)
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(projectName)
                                   .CreateInstance(identifier: projectName)
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            CleanBinObj(projectDirectory);

            var outputComparisonData = BuildProjectJsonMigrateBuildMSBuild(projectDirectory, projectName);

            var outputsIdentical =
                outputComparisonData.ProjectJsonBuildOutputs.SetEquals(outputComparisonData.MSBuildBuildOutputs);

            if (!outputsIdentical)
            {
                OutputDiagnostics(outputComparisonData);
            }

            outputsIdentical.Should().BeTrue();

            VerifyAllMSBuildOutputsRunnable(projectDirectory);

            var outputCsProj = projectDirectory.GetFile(projectName + ".csproj");

            outputCsProj.ReadAllText()
            .Should().EndWith("\n");
        }
示例#21
0
        public void ItMigratesOldDotnetNewWebWithoutToolsWithOutputsContainingProjectJsonOutputs()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("ProjectJsonWebTemplate")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            var globalDirectory = projectDirectory.Parent;

            WriteGlobalJson(globalDirectory);

            var outputComparisonData = GetComparisonData(projectDirectory);

            var outputsIdentical =
                outputComparisonData.ProjectJsonBuildOutputs.SetEquals(outputComparisonData.MSBuildBuildOutputs);

            if (!outputsIdentical)
            {
                OutputDiagnostics(outputComparisonData);
            }

            outputsIdentical.Should().BeTrue();
        }
示例#22
0
        public void ItBinplacesContentOnPublishForWebApps()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("ProjectJsonWebTemplate")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            new MigrateTestCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute($"{projectDirectory.FullName}")
            .Should()
            .Pass();

            var command = new RestoreCommand()
                          .WithWorkingDirectory(projectDirectory)
                          .Execute()
                          .Should()
                          .Pass();

            var result = new PublishCommand()
                         .WithWorkingDirectory(projectDirectory)
                         .ExecuteWithCapturedOutput()
                         .Should()
                         .Pass();

            var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish");

            publishDir.Should().Exist().And.HaveFile("README.md");
            publishDir.GetDirectory("wwwroot").Should().Exist();
        }
示例#23
0
        public void ItBinplacesContentOnBuildForConsoleApps()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("TestAppWithContents")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .WithEmptyGlobalJson()
                                   .Root;

            new MigrateTestCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute($"{projectDirectory.FullName}")
            .Should()
            .Pass();


            var command = new RestoreCommand()
                          .WithWorkingDirectory(projectDirectory)
                          .Execute()
                          .Should()
                          .Pass();

            var result = new BuildCommand()
                         .WithWorkingDirectory(projectDirectory)
                         .ExecuteWithCapturedOutput()
                         .Should()
                         .Pass();

            var outputDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0");

            outputDir.Should().Exist().And.HaveFile("testcontentfile.txt");
            outputDir.GetDirectory("dir").Should().Exist().And.HaveFile("mappingfile.txt");
        }
示例#24
0
        public void MigratingDeprecatedContent()
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJDeprecatedContent")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .Root
                                   .GetDirectory("project");

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("migrate")
            .Should().Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("restore")
            .Should().Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("build -c Debug")
            .Should().Pass();

            new DotnetCommand()
            .WithWorkingDirectory(projectDirectory)
            .Execute("publish -c Debug")
            .Should().Pass();

            var outputDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0");

            outputDir.Should().Exist()
            .And.HaveFiles(new[]
            {
                "ContentFile1.txt",
                "ContentFile2.txt",
                "ContentFileBuiltIn1.txt",
                "ContentFileBuiltIn2.txt",
                "IncludeThis.txt",
            });
            Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
            Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis2.txt")).Should().BeFalse();

            var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish");

            publishDir.Should().Exist()
            .And.HaveFiles(new[]
            {
                "ContentFile1.txt",
                "ContentFile2.txt",
                "ContentFileBuiltIn1.txt",
                "ContentFileBuiltIn2.txt",
                "IncludeThis.txt",
            });
            Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
            Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis2.txt")).Should().BeFalse();
        }
        public void ItMigratesAndBuildsLibrary(string projectName)
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson(projectName)
                                   .CreateInstance(identifier: projectName)
                                   .WithSourceFiles()
                                   .Root;

            MigrateProject(projectDirectory.FullName);
            Restore(projectDirectory, projectName);
            BuildMSBuild(projectDirectory, projectName);
        }
        public void ItMigratesRootProjectAndSkipsReferences(string projectName)
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("TestAppDependencyGraph")
                                   .CreateInstance($"{projectName}.SkipRefsTest")
                                   .WithSourceFiles()
                                   .Root;

            MigrateProject(new [] { projectDirectory.GetDirectory(projectName).FullName, "--skip-project-references" });

            VerifyMigration(Enumerable.Repeat(projectName, 1), projectDirectory);
        }
        public void ItMigratesRootProjectAndReferences(string projectName, string expectedProjects)
        {
            var projectDirectory = TestAssets
                                   .GetProjectJson("TestAppDependencyGraph")
                                   .CreateInstance(identifier: $"{projectName}.RefsTest")
                                   .WithSourceFiles()
                                   .Root;

            MigrateProject(new [] { projectDirectory.GetDirectory(projectName).FullName });

            string[] migratedProjects = expectedProjects.Split(new char[] { ',' });

            VerifyMigration(migratedProjects, projectDirectory);
        }
        public void ItMigratesAndPublishesProjectsWithRuntimes()
        {
            var projectName      = "PJTestAppSimple";
            var projectDirectory = TestAssets
                                   .GetProjectJson(projectName)
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .WithRestoreFiles()
                                   .Root;

            CleanBinObj(projectDirectory);
            BuildProjectJsonMigrateBuildMSBuild(projectDirectory, projectName);
            PublishMSBuild(projectDirectory, projectName, "win7-x64");
        }
        public void ItMigratesWhenBeingPassedAFullPathToGlobalJson()
        {
            var solutionDirectory = TestAssets
                                    .GetProjectJson("AppWithPackageNamedAfterFolder")
                                    .CreateInstance()
                                    .WithSourceFiles()
                                    .Root;

            var globalJsonPath = solutionDirectory.GetFile("global.json");

            new MigrateTestCommand()
            .Execute($"{globalJsonPath.FullName}")
            .Should()
            .Pass();
        }
        public void ItMigratesAProjectThatDependsOnAMigratedProjectWithTheSkipProjectReferenceFlag()
        {
            const string dependentProject  = "ProjectA";
            const string dependencyProject = "ProjectB";

            var projectDirectory = TestAssets
                                   .GetProjectJson("TestAppDependencyGraph")
                                   .CreateInstance()
                                   .WithSourceFiles()
                                   .Root;

            MigrateProject(projectDirectory.GetDirectory(dependencyProject).FullName);

            MigrateProject("--skip-project-references", projectDirectory.GetDirectory(dependentProject).FullName);
        }