Merge pull request #4463 from brthor/brthor/imports

Turn on tests
This commit is contained in:
Livar 2016-10-21 14:22:21 -07:00 committed by GitHub
commit caf072daeb
5 changed files with 60 additions and 9 deletions

View file

@ -0,0 +1,13 @@
using System;
using System.Xml;
namespace ConsoleApplication
{
public class Program
{
public static void Main()
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,21 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": false
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50",
"dependencies": {
"NETStandard.Library": "1.6.0"
}
},
"netstandard1.5": {
"imports": "dnxcore50",
"dependencies": {
"NETStandard.Library": "1.6.0"
}
}
}
}

View file

@ -11,14 +11,14 @@ 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
{
public class GivenThatIWantToMigrateTestApps : TestBase
{
[Theory]
// TODO: Standalone apps [InlineData("TestAppSimple", false)]
// https://github.com/dotnet/sdk/issues/73 [InlineData("TestAppWithLibrary/TestApp", false)]
[InlineData("TestAppWithRuntimeOptions")]
[InlineData("TestAppWithContents")]
public void It_migrates_apps(string projectName)
@ -91,14 +91,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 =
@ -113,8 +122,7 @@ namespace Microsoft.DotNet.Migration.Tests
}
[Theory]
// TODO: Enable this when X-Targeting is in
// [InlineData("TestLibraryWithMultipleFrameworks")]
[InlineData("TestLibraryWithTwoFrameworks")]
public void It_migrates_projects_with_multiple_TFMs(string projectName)
{
var projectDirectory =
@ -521,12 +529,12 @@ namespace Microsoft.DotNet.Migration.Tests
if (projectName != null)
{
command.Execute($"{projectName}.csproj /p:SkipInvalidConfigurations=true")
command.Execute($"{projectName}.csproj /p:SkipInvalidConfigurations=true;_InvalidConfigurationWarning=false")
.Should().Pass();
}
else
{
command.Execute("/p:SkipInvalidConfigurations=true")
command.Execute("/p:SkipInvalidConfigurations=true;_InvalidConfigurationWarning=false")
.Should().Pass();
}
}
@ -592,5 +600,14 @@ namespace Microsoft.DotNet.Migration.Tests
MSBuildBuildOutputs = msBuildBuildOutputs;
}
}
private void WriteGlobalJson(string globalDirectory)
{
var file = Path.Combine(globalDirectory, "global.json");
File.WriteAllText(file, @"
{
""projects"": [ ]
}");
}
}
}