Fixing dotnet migrate global.json. This was failing because we were turning global.json into an empty string and trying to construct a directory for it. The fix was to detect this and transform it into a . directory. Migrate is already respecting the projects node in global.json.

This commit is contained in:
Livar Cunha 2017-01-19 10:32:32 -08:00
parent 908b6515cb
commit cdf91f2f30
11 changed files with 83 additions and 8 deletions

View file

@ -0,0 +1,42 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using System.IO;
using Xunit;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantToMigrateAppsUsingGlobalJson : TestBase
{
[Fact]
public void ItMigratesWhenBeingPassedAFullPathToGlobalJson()
{
var solutionDirectory =
TestAssetsManager.CreateTestInstance("AppWithPackageNamedAfterFolder").Path;
var globalJsonPath = Path.Combine(solutionDirectory, "global.json");
new TestCommand("dotnet")
.WithForwardingToConsole()
.Execute($"migrate {globalJsonPath}")
.Should()
.Pass();
}
[Fact]
public void ItMigratesWhenBeingPassedJustGlobalJson()
{
var solutionDirectory =
TestAssetsManager.CreateTestInstance("AppWithPackageNamedAfterFolder").Path;
new TestCommand("dotnet")
.WithWorkingDirectory(solutionDirectory)
.WithForwardingToConsole()
.Execute($"migrate global.json")
.Should()
.Pass();
}
}
}