コード例 #1
0
        public void It_combines_inner_rids_for_restore(
            string identifier,
            string outerRid,
            string outerRids,
            string firstFrameworkRid,
            string firstFrameworkRids,
            string secondFrameworkRid,
            string secondFrameworkRids,
            string expectedCombination)
        {
            var testAsset = _testAssetsManager
                            .CopyTestAsset(Path.Combine("CrossTargeting", "NetStandardAndNetCoreApp"), identifier: identifier)
                            .WithSource()
                            .WithProjectChanges(project =>
            {
                var ns            = project.Root.Name.Namespace;
                var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First();

                propertyGroup.Add(
                    new XElement(ns + "RuntimeIdentifier", outerRid),
                    new XElement(ns + "RuntimeIdentifiers", outerRids));

                propertyGroup.AddAfterSelf(
                    new XElement(ns + "PropertyGroup",
                                 new XAttribute(ns + "Condition", "'$(TargetFramework)' == 'netstandard1.5'"),
                                 new XElement(ns + "RuntimeIdentifier", firstFrameworkRid),
                                 new XElement(ns + "RuntimeIdentifiers", firstFrameworkRids)),
                    new XElement(ns + "PropertyGroup",
                                 new XAttribute(ns + "Condition", $"'$(TargetFramework)' == '{ToolsetInfo.CurrentTargetFramework}'"),
                                 new XElement(ns + "RuntimeIdentifier", secondFrameworkRid),
                                 new XElement(ns + "RuntimeIdentifiers", secondFrameworkRids)));
            });

            var command = new GetValuesCommand(Log, testAsset.TestRoot, "", valueName: "RuntimeIdentifiers");

            command.DependsOnTargets = "GetAllRuntimeIdentifiers";
            command.ExecuteWithoutRestore().Should().Pass();
            command.GetValues().Should().BeEquivalentTo(expectedCombination.Split(';'));
        }