From 481aebd18adb6e55f35cf0b975a8005f03299c65 Mon Sep 17 00:00:00 2001 From: Bryan Thornbury Date: Thu, 20 Oct 2016 15:04:53 -0700 Subject: [PATCH] turn on the web test --- .../{project.json.template => project.json} | 0 .../GivenThatIWantToMigrateTestApps.cs | 26 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) rename TestAssets/TestProjects/ProjectJsonWebTemplate/{project.json.template => project.json} (100%) diff --git a/TestAssets/TestProjects/ProjectJsonWebTemplate/project.json.template b/TestAssets/TestProjects/ProjectJsonWebTemplate/project.json similarity index 100% rename from TestAssets/TestProjects/ProjectJsonWebTemplate/project.json.template rename to TestAssets/TestProjects/ProjectJsonWebTemplate/project.json diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 188e79700..31e80dcb1 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -11,6 +11,8 @@ using Microsoft.DotNet.Tools.Migrate; using Build3Command = Microsoft.DotNet.Tools.Test.Utilities.Build3Command; using BuildCommand = Microsoft.DotNet.Tools.Test.Utilities.BuildCommand; using System.Runtime.Loader; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace Microsoft.DotNet.Migration.Tests { @@ -90,14 +92,23 @@ namespace Microsoft.DotNet.Migration.Tests VerifyAllMSBuildOutputsRunnable(projectDirectory); } - [Fact(Skip="https://github.com/dotnet/cli/issues/4299")] - public void It_migrates_dotnet_new_web_with_outputs_containing_project_json_outputs() + [Fact] + public void It_migrates_old_dotnet_new_web_without_tools_with_outputs_containing_project_json_outputs() { var testInstance = TestAssetsManager - .CreateTestInstance("ProjectJsonWebTemplate"); + .CreateTestInstance("ProjectJsonWebTemplate") + .WithLockFiles(); var projectDirectory = testInstance.Path; + var globalDirectory = Path.Combine(projectDirectory, ".."); + var projectJsonFile = Path.Combine(projectDirectory, "project.json"); + + WriteGlobalJson(globalDirectory); + var projectJson = JObject.Parse(File.ReadAllText(projectJsonFile)); + projectJson.Remove("tools"); + File.WriteAllText(projectJsonFile, projectJson.ToString()); + var outputComparisonData = GetComparisonData(projectDirectory); var outputsIdentical = @@ -591,5 +602,14 @@ namespace Microsoft.DotNet.Migration.Tests MSBuildBuildOutputs = msBuildBuildOutputs; } } + + private void WriteGlobalJson(string globalDirectory) + { + var file = Path.Combine(globalDirectory, "global.json"); + File.WriteAllText(file, @" + { + ""projects"": [ ] + }"); + } } }