Fixing full framework tests.
This commit is contained in:
parent
abe7641f03
commit
7e5f18b584
4 changed files with 42 additions and 41 deletions
|
@ -5,21 +5,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net20": {
|
|
||||||
"frameworkAssemblies": {
|
|
||||||
"System.Xml": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net35": {
|
|
||||||
"frameworkAssemblies": {
|
|
||||||
"System.Xml": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net40": {
|
|
||||||
"frameworkAssemblies": {
|
|
||||||
"System.Xml": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"net461": {
|
"net461": {
|
||||||
"frameworkAssemblies": {
|
"frameworkAssemblies": {
|
||||||
"System.Xml": {}
|
"System.Xml": {}
|
||||||
|
@ -27,7 +12,10 @@
|
||||||
},
|
},
|
||||||
"netcoreapp1.0": {
|
"netcoreapp1.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.NetCore.App": "1.0.1"
|
"Microsoft.NetCore.App": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"type": "platform"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,9 +149,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
|
||||||
" OR ",
|
" OR ",
|
||||||
projectContexts.Where(p => p.IsFullFramework()).Select(
|
projectContexts.Where(p => p.IsFullFramework()).Select(
|
||||||
p => $"'$(TargetFramework)' == '{p.TargetFramework.GetShortFolderName()}'"));
|
p => $"'$(TargetFramework)' == '{p.TargetFramework.GetShortFolderName()}'"));
|
||||||
|
|
||||||
|
msBuildCondition = $" {msBuildCondition} ";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $" {msBuildCondition} ";
|
return msBuildCondition;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
|
|
||||||
private string _configuration;
|
private string _configuration;
|
||||||
|
|
||||||
private NuGetFramework _framework;
|
private string _framework;
|
||||||
|
|
||||||
private string _runtime;
|
private string _runtime;
|
||||||
|
|
||||||
|
@ -72,6 +72,13 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
}
|
}
|
||||||
|
|
||||||
public BuildCommand WithFramework(NuGetFramework framework)
|
public BuildCommand WithFramework(NuGetFramework framework)
|
||||||
|
{
|
||||||
|
_framework = framework.GetShortFolderName();
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BuildCommand WithFramework(string framework)
|
||||||
{
|
{
|
||||||
_framework = framework;
|
_framework = framework;
|
||||||
|
|
||||||
|
@ -137,7 +144,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $"--framework {_framework.GetShortFolderName()}";
|
return $"--framework {_framework}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetRuntime()
|
private string GetRuntime()
|
||||||
|
|
|
@ -27,26 +27,6 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
[InlineData("AppWithAssemblyInfo")]
|
[InlineData("AppWithAssemblyInfo")]
|
||||||
[InlineData("TestAppWithEmbeddedResources")]
|
[InlineData("TestAppWithEmbeddedResources")]
|
||||||
public void ItMigratesApps(string projectName)
|
public void ItMigratesApps(string projectName)
|
||||||
{
|
|
||||||
var projectDirectory = MigrateApps(projectName);
|
|
||||||
|
|
||||||
VerifyAllMSBuildOutputsRunnable(projectDirectory);
|
|
||||||
|
|
||||||
var outputCsProj = Path.Combine(projectDirectory, projectName + ".csproj");
|
|
||||||
var csproj = File.ReadAllText(outputCsProj);
|
|
||||||
csproj.EndsWith("\n").Should().Be(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
[WindowsOnlyTheory]
|
|
||||||
[InlineData("TestAppWithMultipleFrameworksAndRuntimes")]
|
|
||||||
[InlineData("TestAppWithMultipleFrameworksAndNoRuntimes")]
|
|
||||||
[InlineData("TestAppWithMultipleFrameworksOnly")]
|
|
||||||
public void ItMigratesAppsWithFullFramework(string projectName)
|
|
||||||
{
|
|
||||||
MigrateApps(projectName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string MigrateApps(string projectName)
|
|
||||||
{
|
{
|
||||||
var projectDirectory = TestAssetsManager.CreateTestInstance(projectName, identifier: projectName)
|
var projectDirectory = TestAssetsManager.CreateTestInstance(projectName, identifier: projectName)
|
||||||
.WithLockFiles()
|
.WithLockFiles()
|
||||||
|
@ -66,7 +46,29 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
|
|
||||||
outputsIdentical.Should().BeTrue();
|
outputsIdentical.Should().BeTrue();
|
||||||
|
|
||||||
return projectDirectory;
|
VerifyAllMSBuildOutputsRunnable(projectDirectory);
|
||||||
|
|
||||||
|
var outputCsProj = Path.Combine(projectDirectory, projectName + ".csproj");
|
||||||
|
var csproj = File.ReadAllText(outputCsProj);
|
||||||
|
csproj.EndsWith("\n").Should().Be(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
[WindowsOnlyTheory]
|
||||||
|
[InlineData("TestAppWithMultipleFrameworksAndNoRuntimes", null)]
|
||||||
|
[InlineData("TestAppWithMultipleFullFrameworksOnly", "net461")]
|
||||||
|
public void ItMigratesAppsWithFullFramework(string projectName, string framework)
|
||||||
|
{
|
||||||
|
var projectDirectory = TestAssetsManager.CreateTestInstance(
|
||||||
|
projectName,
|
||||||
|
identifier: projectName).WithLockFiles().Path;
|
||||||
|
|
||||||
|
CleanBinObj(projectDirectory);
|
||||||
|
|
||||||
|
MigrateProject(new [] { projectDirectory });
|
||||||
|
|
||||||
|
Restore(projectDirectory);
|
||||||
|
|
||||||
|
BuildMSBuild(projectDirectory, projectName, framework: framework);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -711,7 +713,8 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
string projectDirectory,
|
string projectDirectory,
|
||||||
string projectName,
|
string projectName,
|
||||||
string configuration="Debug",
|
string configuration="Debug",
|
||||||
string runtime=null)
|
string runtime=null,
|
||||||
|
string framework=null)
|
||||||
{
|
{
|
||||||
if (projectName != null && !Path.HasExtension(projectName))
|
if (projectName != null && !Path.HasExtension(projectName))
|
||||||
{
|
{
|
||||||
|
@ -723,6 +726,7 @@ namespace Microsoft.DotNet.Migration.Tests
|
||||||
var result = new BuildCommand()
|
var result = new BuildCommand()
|
||||||
.WithWorkingDirectory(projectDirectory)
|
.WithWorkingDirectory(projectDirectory)
|
||||||
.WithRuntime(runtime)
|
.WithRuntime(runtime)
|
||||||
|
.WithFramework(framework)
|
||||||
.ExecuteWithCapturedOutput($"{projectName} /p:Configuration={configuration}");
|
.ExecuteWithCapturedOutput($"{projectName} /p:Configuration={configuration}");
|
||||||
|
|
||||||
result
|
result
|
||||||
|
|
Loading…
Reference in a new issue