Tmx.TmxOpenTestSuiteCommand.Execute C# (CSharp) Method

Execute() private method

private Execute ( ) : void
return void
        internal override void Execute()
        {
            var cmdlet = (OpenSuiteCmdletBase)Cmdlet;
            
            bool result =
                TmxHelper.OpenTestSuite(
                    cmdlet.Name,
                    cmdlet.Id,
                    (TestData.TestPlatforms.FirstOrDefault(tp => tp.Id == cmdlet.TestPlatformId) ?? TestData.CurrentTestPlatform).UniqueId);
            
            if (result)
                cmdlet.WriteObject(cmdlet, TestData.CurrentTestSuite);
            else
                cmdlet.WriteError(
                    cmdlet,
                    "Couldn't get a test suite",
                    "GettingTestSuite",
                    ErrorCategory.InvalidArgument,
                    true);
        }
    }

Usage Example

Beispiel #1
0
        // internal static ITestSuite GetExistingTestSuite(
        internal static object GetExistingTestSuite(
            string name,
            string id)
        {

            var cmdlet = new OpenSuiteCmdletBase();

            if (!string.IsNullOrEmpty(name))
                cmdlet.Name = name;
            if (!string.IsNullOrEmpty(id))
                cmdlet.Id = id;
            
            var command = new TmxOpenTestSuiteCommand(cmdlet);
            command.Execute();
            
            // 20140715
            // return (ITestSuite)(object)UnitTestOutput.LastOutput[0];
            var returnValue = (object)UnitTestOutput.LastOutput[0];
            if (returnValue is ITestSuite)
                return returnValue as ITestSuite;
            if (returnValue is ErrorRecord)
                return returnValue as ErrorRecord;
            return returnValue;
        }
TmxOpenTestSuiteCommand