PSTestLib.PSCmdletBase.runSBActionWithParams C# (CSharp) Method

runSBActionWithParams() public method

public runSBActionWithParams ( ScriptBlock sb, object parameters ) : void
sb ScriptBlock
parameters object
return void
        void runSBActionWithParams(
            ScriptBlock sb,
            object[] parameters)
        {
            Collection<PSObject> psObjects = null;
            try {
                
//                WriteVerbose(
//                    this,
//                    "select whether a scriptblock has parameters or doesn't");
                
                if (null == parameters || 0 == parameters.Length)
//                    WriteVerbose(
//                        this,
//                        "without parameters");
                    psObjects =
                        sb.Invoke();
                else
//                    WriteVerbose(
//                        this,
//                        "with parameters");
                    psObjects =
                        sb.Invoke(parameters);
                
//                WriteVerbose(
//                    this,
//                    "scriptblock has been fired successfully");

            } catch (Exception eOuter) {

                // 20130318
//                ErrorRecord err = 
//                    new ErrorRecord(eOuter,
//                                    "ErrorInInvokingScriptBlock",
//                                    ErrorCategory.InvalidOperation,
//                                    System.Management.Automation.Runspaces.Runspace.DefaultRunspace);
//                err.ErrorDetails = 
//                    new ErrorDetails(
//                        "Unable to issue the following command:\r\n" +
//                        sb.ToString() + 
//                        "\r\nThe exception raised is\r\n" + 
//                        eOuter.Message);
//                                     //"System.Management.Automation.Runspaces.Runspace.DefaultRunspace = RunspaceFactory.CreateRunspace();");
//                WriteError(err);
                
                // 20130606
//                this.WriteVerbose(
//                    this,
//                    eOuter.InnerException.Message);
                
                WriteError(
                    this,
                    "Unable to issue the following command:\r\n" +
                    sb +
                    "\r\nThe exception raised is\r\n" +
                    eOuter.Message,
                    "ErrorInInvokingScriptBlock",
                    ErrorCategory.InvalidOperation,
                    // 20130318
                    //false);
                    true);

            }
        }
        #endregion Action delegate