CmdletUnitTest.TestRunspace.RunAndCompareTwoOutputs C# (CSharp) Method

RunAndCompareTwoOutputs() public static method

public static RunAndCompareTwoOutputs ( string codeSnippet, List sourceIndices, List targetIndices ) : void
codeSnippet string
sourceIndices List
targetIndices List
return void
        public static void RunAndCompareTwoOutputs(
            string codeSnippet,
            List<int> sourceIndices,
            List<int> targetIndices)
        {
            //reportRunningCode(codeSnippet);
            var coll = PSRunner.Runner.RunPSCode(codeSnippet, showCode);
            var sourceList = new List<object>();
            foreach (int i in sourceIndices)
                sourceList.Add(coll[i]);
            var targetList = new List<object>();
            foreach (int i in targetIndices)
                targetList.Add(coll[i]);
            Assert.AreEqual(sourceList, targetList);
            PSRunner.Runner.FinishRunningCode();
        }