private List <string> GetValuesFromTestLibrary(string itemTypeOrPropertyName, Action <GetValuesCommand> setup = null, string[] msbuildArgs = null,
                                                       GetValuesCommand.ValueType valueType = GetValuesCommand.ValueType.Item, [CallerMemberName] string callingMethod = "")
        {
            msbuildArgs = msbuildArgs ?? Array.Empty <string>();

            string targetFramework = "netstandard1.5";

            var testAsset = _testAssetsManager
                            .CopyTestAsset("AppWithLibrary", callingMethod)
                            .WithSource()
                            .Restore(relativePath: "TestLibrary");

            var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "TestLibrary");

            var getValuesCommand = new GetValuesCommand(Stage0MSBuild, libraryProjectDirectory,
                                                        targetFramework, itemTypeOrPropertyName, valueType);

            if (setup != null)
            {
                setup(getValuesCommand);
            }

            getValuesCommand
            .Execute(msbuildArgs)
            .Should()
            .Pass();

            var itemValues = getValuesCommand.GetValues();

            return(itemValues);
        }
Beispiel #2
0
        internal static List <string> GetValuesFromTestLibrary(
            ITestOutputHelper log,
            TestAssetsManager testAssetsManager,
            string itemTypeOrPropertyName,
            Action <GetValuesCommand> setup         = null,
            string[] msbuildArgs                    = null,
            GetValuesCommand.ValueType valueType    = GetValuesCommand.ValueType.Item,
            [CallerMemberName] string callingMethod = "",
            Action <XDocument> projectChanges       = null)
        {
            msbuildArgs = msbuildArgs ?? Array.Empty <string>();

            string targetFramework = "netstandard1.5";

            var testAsset = testAssetsManager
                            .CopyTestAsset("AppWithLibrary", callingMethod)
                            .WithSource();

            if (projectChanges != null)
            {
                testAsset.WithProjectChanges(projectChanges);
            }

            testAsset.Restore(log, relativePath: "TestLibrary");

            var libraryProjectDirectory = Path.Combine(testAsset.TestRoot, "TestLibrary");

            var getValuesCommand = new GetValuesCommand(log, libraryProjectDirectory,
                                                        targetFramework, itemTypeOrPropertyName, valueType);

            if (setup != null)
            {
                setup(getValuesCommand);
            }

            getValuesCommand
            .Execute(msbuildArgs)
            .Should()
            .Pass();

            var itemValues = getValuesCommand.GetValues();

            return(itemValues);
        }