Description of TestCaseExecCmdletBase.
Inheritance: TestExecCmdletBase
        // 20140720
        public void RunTestCase(
            TestCaseExecCmdletBase cmdlet,
            // 20140720
//            TestSuite testSuite,
//            TestScenario testScenario)
            ITestSuite testSuite,
            ITestScenario testScenario)
        {
            var testCase =
                TestData.GetTestCase(
                    testSuite,
                    string.Empty, //cmdlet.Name
                    cmdlet.Id,
                    testScenario.Name,
                    testScenario.Id,
                    testSuite.Name,
                    testSuite.Id,
                    // 20141119
                    // testScenario.PlatformId);
                    testScenario.PlatformUniqueId);

            if (null == testCase)
            {
                return;
            }

            // run BeforeScenario scriptblocks
            //if (null != testSuite) {
            if (null != testSuite && null != testScenario)
            {
                cmdlet.runTwoScriptBlockCollections(
                    // 20141211
                    // testSuite.BeforeScenario,
                    testSuite.BeforeScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                    null, // alternate scriptblocks
                    cmdlet,
                    testSuite.BeforeScenarioParameters);
            }

            // run BeforeTest scriptblocks
            if (null != testScenario)
            {
                cmdlet.runTwoScriptBlockCollections(
                    // 20141211
                    // testScenario.BeforeTest,
                    testScenario.BeforeTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                    null, // alternate scriptblocks
                    cmdlet,
                    testScenario.BeforeTestParameters);
            }

            // run TestCode scriptblocks
            cmdlet.runTwoScriptBlockCollections(
                //cmdlet.TestCode,
                // 20141211
                // testCase.TestCode,
                testCase.TestCode.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                null,
                cmdlet,
                cmdlet.TestCodeParameters);

            // run AfterTest scriptblocks
            if (null != testScenario)
            {
                cmdlet.runTwoScriptBlockCollections(
                    // 20141211
                    // testScenario.AfterTest,
                    testScenario.AfterTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                    null, // alternate scriptblocks
                    cmdlet,
                    testScenario.AfterTestParameters);
            }

            // run AfterScenario scriptblocks
            //if (null != testSuite) {
            if (null != testSuite && null != testScenario)
            {
                cmdlet.runTwoScriptBlockCollections(
                    // 20141211
                    // testSuite.AfterScenario,
                    testSuite.AfterScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                    null, // alternate scriptblocks
                    cmdlet,
                    testSuite.AfterScenarioParameters);
            }
        }
Example #2
0
        // 20140720
        public void RunTestCase(
            TestCaseExecCmdletBase cmdlet,
            // 20140720
//            TestSuite testSuite,
//            TestScenario testScenario)
            ITestSuite testSuite,
            ITestScenario testScenario)
        {
            
            var testCase =
                TestData.GetTestCase(
                    testSuite,
                    string.Empty, //cmdlet.Name
                    cmdlet.Id,
                    testScenario.Name,
                    testScenario.Id,
                    testSuite.Name,
                    testSuite.Id,
                    // 20141119
                    // testScenario.PlatformId);
                    testScenario.PlatformUniqueId);
            if (null == testCase) {
                return;
            }
            
            // run BeforeScenario scriptblocks
            //if (null != testSuite) {
            if (null != testSuite && null != testScenario) {
                cmdlet.runTwoScriptBlockCollections(
                    // 20141211
                    // testSuite.BeforeScenario,
                    testSuite.BeforeScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                    null, // alternate scriptblocks
                    cmdlet,
                    testSuite.BeforeScenarioParameters);
            }
            
            // run BeforeTest scriptblocks
            if (null != testScenario) {
                cmdlet.runTwoScriptBlockCollections(
                    // 20141211
                    // testScenario.BeforeTest,
                    testScenario.BeforeTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                    null, // alternate scriptblocks
                    cmdlet,
                    testScenario.BeforeTestParameters);
            }
            
            // run TestCode scriptblocks
            cmdlet.runTwoScriptBlockCollections(
                //cmdlet.TestCode,
                // 20141211
                // testCase.TestCode,
                testCase.TestCode.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                null,
                cmdlet,
                cmdlet.TestCodeParameters);
            
            // run AfterTest scriptblocks
            if (null != testScenario) {
                cmdlet.runTwoScriptBlockCollections(
                    // 20141211
                    // testScenario.AfterTest,
                    testScenario.AfterTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                    null, // alternate scriptblocks
                    cmdlet,
                    testScenario.AfterTestParameters);
            }
            
            // run AfterScenario scriptblocks
            //if (null != testSuite) {
            if (null != testSuite && null != testScenario) {
                cmdlet.runTwoScriptBlockCollections(
                    // 20141211
                    // testSuite.AfterScenario,
                    testSuite.AfterScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(),
                    null, // alternate scriptblocks
                    cmdlet,
                    testSuite.AfterScenarioParameters);
            }
            
        }