2016-09-27 04:40:11 +00:00
|
|
|
// 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 Microsoft.Build.Construction;
|
|
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
|
|
using System.Linq;
|
|
|
|
using Xunit;
|
|
|
|
using FluentAssertions;
|
2016-10-10 21:24:49 +00:00
|
|
|
using Microsoft.DotNet.ProjectJsonMigration;
|
2016-09-27 04:40:11 +00:00
|
|
|
using Microsoft.DotNet.ProjectJsonMigration.Rules;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.ProjectJsonMigration.Tests
|
|
|
|
{
|
2016-10-29 00:22:58 +00:00
|
|
|
public class GivenThatIWantToMigratePackageDependencies : PackageDependenciesTestBase
|
2016-09-27 04:40:11 +00:00
|
|
|
{
|
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesBasicPackageReference()
|
2016-09-27 04:40:11 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""dependencies"": {
|
|
|
|
""APackage"" : ""1.0.0-preview"",
|
|
|
|
""BPackage"" : ""1.0.0""
|
|
|
|
}
|
|
|
|
}");
|
2016-12-30 10:04:00 +00:00
|
|
|
|
|
|
|
EmitsPackageReferences(mockProj, Tuple.Create("APackage", "1.0.0-preview", ""), Tuple.Create("BPackage", "1.0.0", ""));
|
2016-09-27 04:40:11 +00:00
|
|
|
}
|
|
|
|
|
2016-10-10 21:24:49 +00:00
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesTypeBuildToPrivateAssets()
|
2016-10-10 21:24:49 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""dependencies"": {
|
|
|
|
""APackage"" : {
|
|
|
|
""version"": ""1.0.0-preview"",
|
|
|
|
""type"": ""build""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}");
|
|
|
|
|
2016-10-10 23:19:57 +00:00
|
|
|
|
2016-10-10 21:24:49 +00:00
|
|
|
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
|
|
|
|
|
|
|
var privateAssetsMetadata = packageRef.GetMetadataWithName("PrivateAssets");
|
2016-10-10 23:19:57 +00:00
|
|
|
privateAssetsMetadata.Value.Should().NotBeNull();
|
2016-10-10 21:24:49 +00:00
|
|
|
privateAssetsMetadata.Value.Should().Be("All");
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesSuppressParentArrayToPrivateAssets()
|
2016-10-10 21:24:49 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""dependencies"": {
|
|
|
|
""APackage"" : {
|
|
|
|
""version"": ""1.0.0-preview"",
|
|
|
|
""suppressParent"":[ ""runtime"", ""native"" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}");
|
2016-10-10 23:19:57 +00:00
|
|
|
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
|
|
|
|
|
|
|
var privateAssetsMetadata = packageRef.GetMetadataWithName("PrivateAssets");
|
|
|
|
privateAssetsMetadata.Value.Should().NotBeNull();
|
|
|
|
privateAssetsMetadata.Value.Should().Be("Native;Runtime");
|
|
|
|
}
|
2016-10-10 21:24:49 +00:00
|
|
|
|
2016-10-10 23:19:57 +00:00
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesSuppressParentStringToPrivateAssets()
|
2016-10-10 23:19:57 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""dependencies"": {
|
|
|
|
""APackage"" : {
|
|
|
|
""version"": ""1.0.0-preview"",
|
|
|
|
""suppressParent"":""runtime""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}");
|
2016-10-10 21:24:49 +00:00
|
|
|
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
|
|
|
|
|
|
|
var privateAssetsMetadata = packageRef.GetMetadataWithName("PrivateAssets");
|
2016-10-10 23:19:57 +00:00
|
|
|
privateAssetsMetadata.Value.Should().NotBeNull();
|
|
|
|
privateAssetsMetadata.Value.Should().Be("Runtime");
|
2016-10-10 21:24:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesIncludeExcludeArraysToIncludeAssets()
|
2016-10-10 21:24:49 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""dependencies"": {
|
|
|
|
""APackage"" : {
|
|
|
|
""version"": ""1.0.0-preview"",
|
|
|
|
""include"": [ ""compile"", ""runtime"", ""native"" ],
|
|
|
|
""exclude"": [ ""native"" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}");
|
2016-10-10 23:19:57 +00:00
|
|
|
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
2016-10-10 21:24:49 +00:00
|
|
|
|
2016-10-10 23:19:57 +00:00
|
|
|
var includeAssetsMetadata = packageRef.GetMetadataWithName("IncludeAssets");
|
|
|
|
includeAssetsMetadata.Value.Should().NotBeNull();
|
|
|
|
includeAssetsMetadata.Value.Should().Be("Compile;Runtime");
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesIncludeStringToIncludeAssets()
|
2016-10-10 23:19:57 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""dependencies"": {
|
|
|
|
""APackage"" : {
|
|
|
|
""version"": ""1.0.0-preview"",
|
|
|
|
""include"": ""compile"",
|
|
|
|
""exclude"": ""runtime""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}");
|
2016-10-10 21:24:49 +00:00
|
|
|
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
|
|
|
|
2016-10-10 23:19:57 +00:00
|
|
|
var includeAssetsMetadata = packageRef.GetMetadataWithName("IncludeAssets");
|
|
|
|
includeAssetsMetadata.Value.Should().NotBeNull();
|
|
|
|
includeAssetsMetadata.Value.Should().Be("Compile");
|
2016-10-10 21:24:49 +00:00
|
|
|
}
|
|
|
|
|
2016-10-10 23:19:57 +00:00
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesIncludeExcludeOverlappingStringsToIncludeAssets()
|
2016-10-10 23:19:57 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""dependencies"": {
|
|
|
|
""APackage"" : {
|
|
|
|
""version"": ""1.0.0-preview"",
|
|
|
|
""include"": ""compile"",
|
|
|
|
""exclude"": ""compile"",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}");
|
|
|
|
var packageRef = mockProj.Items.First(i => i.Include == "APackage" && i.ItemType == "PackageReference");
|
|
|
|
|
|
|
|
var includeAssetsMetadata = packageRef.GetMetadataWithName("IncludeAssets");
|
|
|
|
includeAssetsMetadata.Value.Should().NotBeNull();
|
|
|
|
includeAssetsMetadata.Value.Should().Be("None");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-10-05 18:36:23 +00:00
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesTools()
|
2016-10-05 18:36:23 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""tools"": {
|
|
|
|
""APackage"" : ""1.0.0-preview"",
|
|
|
|
""BPackage"" : ""1.0.0""
|
|
|
|
}
|
|
|
|
}");
|
2016-12-30 10:04:00 +00:00
|
|
|
|
|
|
|
EmitsToolReferences(mockProj, Tuple.Create("APackage", "1.0.0-preview"), Tuple.Create("BPackage", "1.0.0"));
|
2016-10-05 18:36:23 +00:00
|
|
|
}
|
|
|
|
|
2016-10-11 22:22:18 +00:00
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesImportsPerFramework()
|
2016-10-11 22:22:18 +00:00
|
|
|
{
|
|
|
|
var importPropertyName = "PackageTargetFallback";
|
|
|
|
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""frameworks"": {
|
|
|
|
""netcoreapp1.0"" : {
|
|
|
|
""imports"": [""netstandard1.3"", ""net451""]
|
|
|
|
},
|
|
|
|
""netstandard1.3"" : {
|
|
|
|
""imports"": [""net451""]
|
|
|
|
},
|
|
|
|
""net451"" : {
|
|
|
|
""imports"": ""netstandard1.3""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}");
|
|
|
|
|
|
|
|
var imports = mockProj.Properties.Where(p => p.Name == importPropertyName);
|
|
|
|
imports.Should().HaveCount(3);
|
|
|
|
|
|
|
|
var netcoreappImport = imports.First(p => p.Condition.Contains("netcoreapp1.0"));
|
|
|
|
var netstandardImport = imports.First(p => p.Condition.Contains("netstandard1.3"));
|
|
|
|
var net451Import = imports.First(p => p.Condition.Contains("net451"));
|
|
|
|
|
|
|
|
netcoreappImport.Should().NotBe(netstandardImport);
|
|
|
|
|
|
|
|
netcoreappImport.Condition.Should().Be(" '$(TargetFramework)' == 'netcoreapp1.0' ");
|
|
|
|
netstandardImport.Condition.Should().Be(" '$(TargetFramework)' == 'netstandard1.3' ");
|
|
|
|
net451Import.Condition.Should().Be(" '$(TargetFramework)' == 'net451' ");
|
|
|
|
|
|
|
|
netcoreappImport.Value.Split(';').Should().BeEquivalentTo($"$({importPropertyName})", "netstandard1.3", "net451");
|
|
|
|
netstandardImport.Value.Split(';').Should().BeEquivalentTo($"$({importPropertyName})", "net451");
|
|
|
|
net451Import.Value.Split(';').Should().BeEquivalentTo($"$({importPropertyName})", "netstandard1.3");
|
|
|
|
}
|
|
|
|
|
2016-10-18 01:02:10 +00:00
|
|
|
[Fact]
|
2017-01-04 20:25:48 +00:00
|
|
|
public void ItDoesNotAddConditionToPackageTargetFallBackWhenMigratingASingleTFM()
|
2017-01-04 01:16:05 +00:00
|
|
|
{
|
|
|
|
var importPropertyName = "PackageTargetFallback";
|
|
|
|
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""frameworks"": {
|
|
|
|
""netcoreapp1.0"" : {
|
|
|
|
""imports"": [""netstandard1.3"", ""net451""]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}");
|
|
|
|
|
|
|
|
var imports = mockProj.Properties.Where(p => p.Name == importPropertyName);
|
|
|
|
imports.Should().HaveCount(1);
|
|
|
|
|
|
|
|
imports.Single().Condition.Should().BeEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
public void ItAutoAddDesktopReferencesDuringMigrate()
|
2016-10-18 01:02:10 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""frameworks"": {
|
|
|
|
""net35"" : {},
|
|
|
|
""net4"" : {},
|
|
|
|
""net451"" : {}
|
|
|
|
}
|
|
|
|
}");
|
|
|
|
|
|
|
|
var itemGroup = mockProj.ItemGroups.Where(i => i.Condition == " '$(TargetFramework)' == 'net451' ");
|
|
|
|
itemGroup.Should().HaveCount(1);
|
|
|
|
itemGroup.First().Items.Should().HaveCount(2);
|
|
|
|
var items = itemGroup.First().Items.ToArray();
|
|
|
|
items[0].Include.Should().Be("System");
|
|
|
|
items[1].Include.Should().Be("Microsoft.CSharp");
|
|
|
|
|
|
|
|
itemGroup = mockProj.ItemGroups.Where(i => i.Condition == " '$(TargetFramework)' == 'net40' ");
|
|
|
|
itemGroup.Should().HaveCount(1);
|
|
|
|
itemGroup.First().Items.Should().HaveCount(2);
|
|
|
|
items = itemGroup.First().Items.ToArray();
|
|
|
|
items[0].Include.Should().Be("System");
|
|
|
|
items[1].Include.Should().Be("Microsoft.CSharp");
|
|
|
|
|
|
|
|
itemGroup = mockProj.ItemGroups.Where(i => i.Condition == " '$(TargetFramework)' == 'net35' ");
|
|
|
|
itemGroup.Should().HaveCount(1);
|
|
|
|
itemGroup.First().Items.Should().HaveCount(1);
|
|
|
|
items = itemGroup.First().Items.ToArray();
|
|
|
|
items[0].Include.Should().Be("System");
|
|
|
|
}
|
|
|
|
|
2016-10-31 22:55:22 +00:00
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesTestProjectsToHaveTestSdk()
|
2016-10-31 22:55:22 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""buildOptions"": {
|
|
|
|
""emitEntryPoint"": true
|
|
|
|
},
|
|
|
|
""frameworks"": {
|
|
|
|
""netcoreapp1.0"": {}
|
|
|
|
},
|
2016-11-02 18:49:45 +00:00
|
|
|
""testRunner"": ""somerunner""
|
2016-10-31 22:55:22 +00:00
|
|
|
}");
|
|
|
|
|
2016-11-01 03:50:52 +00:00
|
|
|
mockProj.Items.Should().ContainSingle(
|
2016-11-01 22:10:51 +00:00
|
|
|
i => (i.Include == "Microsoft.NET.Test.Sdk" &&
|
|
|
|
i.ItemType == "PackageReference" &&
|
2017-01-07 21:31:58 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "15.0.0-preview-20170106-08" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-10-31 22:55:22 +00:00
|
|
|
|
2016-11-01 03:50:52 +00:00
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "xunit" && i.ItemType == "PackageReference"));
|
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "xunit.runner.visualstudio" && i.ItemType == "PackageReference"));
|
2016-11-02 18:49:45 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "MSTest.TestAdapter" && i.ItemType == "PackageReference"));
|
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "MSTest.TestFramework" && i.ItemType == "PackageReference"));
|
2016-10-31 22:55:22 +00:00
|
|
|
}
|
|
|
|
|
2016-10-31 20:59:47 +00:00
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesTestProjectsToHaveTestSdkAndXunitPackagedependencies()
|
2016-10-31 20:59:47 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""buildOptions"": {
|
|
|
|
""emitEntryPoint"": true
|
|
|
|
},
|
|
|
|
""frameworks"": {
|
|
|
|
""netcoreapp1.0"": {}
|
|
|
|
},
|
|
|
|
""testRunner"": ""xunit""
|
|
|
|
}");
|
|
|
|
|
2016-11-01 03:50:52 +00:00
|
|
|
mockProj.Items.Should().ContainSingle(
|
2016-12-30 10:04:00 +00:00
|
|
|
i => (i.Include == "Microsoft.NET.Test.Sdk" &&
|
2016-11-01 22:10:51 +00:00
|
|
|
i.ItemType == "PackageReference" &&
|
2017-01-07 21:31:58 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "15.0.0-preview-20170106-08") &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute);
|
2016-11-01 03:50:52 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().ContainSingle(
|
2016-12-30 10:04:00 +00:00
|
|
|
i => (i.Include == "xunit" &&
|
2016-11-01 22:10:51 +00:00
|
|
|
i.ItemType == "PackageReference" &&
|
2017-01-16 21:08:40 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "2.2.0-beta5-build3474" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-10-31 20:59:47 +00:00
|
|
|
|
2016-11-01 03:50:52 +00:00
|
|
|
mockProj.Items.Should().ContainSingle(
|
2016-12-30 10:04:00 +00:00
|
|
|
i => (i.Include == "xunit.runner.visualstudio" &&
|
2016-11-01 22:10:51 +00:00
|
|
|
i.ItemType == "PackageReference" &&
|
2017-01-16 21:08:40 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "2.2.0-beta5-build1225" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-11-02 18:49:45 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "MSTest.TestAdapter" && i.ItemType == "PackageReference"));
|
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "MSTest.TestFramework" && i.ItemType == "PackageReference"));
|
2016-11-01 22:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesTestProjectsToHaveTestSdkAndXunitPackagedependenciesOverwriteExistingPackagedependencies()
|
2016-11-01 22:10:51 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""buildOptions"": {
|
|
|
|
""emitEntryPoint"": true
|
|
|
|
},
|
|
|
|
""dependencies"": {
|
|
|
|
""xunit"": ""2.2.0-beta3-build3330""
|
|
|
|
},
|
|
|
|
""frameworks"": {
|
|
|
|
""netcoreapp1.0"": {}
|
|
|
|
},
|
|
|
|
""testRunner"": ""xunit""
|
|
|
|
}");
|
|
|
|
|
|
|
|
mockProj.Items.Should().ContainSingle(
|
|
|
|
i => (i.Include == "Microsoft.NET.Test.Sdk" &&
|
|
|
|
i.ItemType == "PackageReference" &&
|
2017-01-07 21:31:58 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "15.0.0-preview-20170106-08" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-11-01 22:10:51 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().ContainSingle(
|
|
|
|
i => (i.Include == "xunit" &&
|
|
|
|
i.ItemType == "PackageReference" &&
|
2017-01-16 21:08:40 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "2.2.0-beta5-build3474" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-11-01 22:10:51 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().ContainSingle(
|
|
|
|
i => (i.Include == "xunit.runner.visualstudio" &&
|
|
|
|
i.ItemType == "PackageReference" &&
|
2017-01-16 21:08:40 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "2.2.0-beta5-build1225" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-11-02 18:49:45 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "MSTest.TestAdapter" && i.ItemType == "PackageReference"));
|
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "MSTest.TestFramework" && i.ItemType == "PackageReference"));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesTestProjectsToHaveTestSdkAndMstestPackagedependencies()
|
2016-11-02 18:49:45 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(@"
|
|
|
|
{
|
|
|
|
""buildOptions"": {
|
|
|
|
""emitEntryPoint"": true
|
|
|
|
},
|
|
|
|
""frameworks"": {
|
|
|
|
""netcoreapp1.0"": {}
|
|
|
|
},
|
|
|
|
""testRunner"": ""mstest""
|
|
|
|
}");
|
|
|
|
|
|
|
|
mockProj.Items.Should().ContainSingle(
|
|
|
|
i => (i.Include == "Microsoft.NET.Test.Sdk" &&
|
|
|
|
i.ItemType == "PackageReference" &&
|
2017-01-07 21:31:58 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "15.0.0-preview-20170106-08" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-11-02 18:49:45 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().ContainSingle(
|
|
|
|
i => (i.Include == "MSTest.TestAdapter" &&
|
|
|
|
i.ItemType == "PackageReference" &&
|
2016-12-29 07:13:02 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "1.1.8-rc" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-11-02 18:49:45 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().ContainSingle(
|
|
|
|
i => (i.Include == "MSTest.TestFramework" &&
|
|
|
|
i.ItemType == "PackageReference" &&
|
2016-12-29 07:13:02 +00:00
|
|
|
i.GetMetadataWithName("Version").Value == "1.0.8-rc" &&
|
2016-12-17 03:13:37 +00:00
|
|
|
i.GetMetadataWithName("Version").ExpressedAsAttribute));
|
2016-11-02 18:49:45 +00:00
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "xunit" && i.ItemType == "PackageReference"));
|
|
|
|
|
|
|
|
mockProj.Items.Should().NotContain(
|
|
|
|
i => (i.Include == "xunit.runner.visualstudio" && i.ItemType == "PackageReference"));
|
2016-10-31 20:59:47 +00:00
|
|
|
}
|
|
|
|
|
2016-10-31 23:34:37 +00:00
|
|
|
[Theory]
|
|
|
|
[InlineData(@"
|
|
|
|
{
|
|
|
|
""frameworks"": {
|
|
|
|
""netstandard1.3"": {
|
|
|
|
""dependencies"": {
|
|
|
|
""System.AppContext"": ""4.1.0"",
|
|
|
|
""NETStandard.Library"": ""1.5.0""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}")]
|
|
|
|
[InlineData(@"
|
|
|
|
{
|
|
|
|
""frameworks"": {
|
|
|
|
""netstandard1.3"": {
|
|
|
|
""dependencies"": {
|
|
|
|
""System.AppContext"": ""4.1.0""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}")]
|
2017-01-04 01:16:05 +00:00
|
|
|
public void ItMigratesLibraryAndDoesNotDoubleNetstandardRef(string pjContent)
|
2016-10-31 23:34:37 +00:00
|
|
|
{
|
|
|
|
var mockProj = RunPackageDependenciesRuleOnPj(pjContent);
|
|
|
|
|
|
|
|
mockProj.Items.Should().ContainSingle(
|
|
|
|
i => (i.Include == "NETStandard.Library" && i.ItemType == "PackageReference"));
|
|
|
|
}
|
2016-09-27 04:40:11 +00:00
|
|
|
}
|
|
|
|
}
|