CheckInitialized() public static method

public static CheckInitialized ( ) : void
return void
Exemplo n.º 1
0
        public void WriteVerbose(PSCmdletBase cmdlet, object obj)
        {
            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }

            string cmdletName   = "? : ";
            string objectString = string.Empty;

            try {
                objectString = obj.ToString();
            }
            catch {}

            if (null != cmdlet)
            {
                try {
                    cmdletName =
                        CmdletSignature(cmdlet);

                    cmdlet.WriteVerbose(cmdletName + objectString);
                }
                catch {
                    cmdlet.WriteVerbose(cmdletName + "failed");
                }
            }
            else
            {
                cmdlet.WriteVerbose(cmdletName + objectString);
            }
        }
Exemplo n.º 2
0
        public virtual void WriteObject(PSCmdletBase cmdlet, string outputObject)
        {
            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }

            writeSingleObject(cmdlet, outputObject);
        }
Exemplo n.º 3
0
        public void WriteObject(PSCmdletBase cmdlet, object outputObject)
        {
            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }

//            cmdlet.WriteVerbose(cmdlet, "outputting the object");

            writeSingleObject(cmdlet, outputObject);
        }
Exemplo n.º 4
0
        public virtual void WriteObject(PSCmdletBase cmdlet, Hashtable outputObjectCollection)
        {
            BeforeWriteCollection(cmdlet, outputObjectCollection);

            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }

            writeSingleObject(cmdlet, outputObjectCollection);

            AfterWriteCollection(cmdlet, outputObjectCollection);
        }
Exemplo n.º 5
0
        public virtual void WriteObject(PSCmdletBase cmdlet, IList outputObjectCollection)
        {
            BeforeWriteCollection(cmdlet, outputObjectCollection);

            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }

            foreach (object item in outputObjectCollection)
            {
                writeSingleObject(cmdlet, item);
            }

            AfterWriteCollection(cmdlet, outputObjectCollection);
        }
Exemplo n.º 6
0
        public virtual void WriteObject(PSCmdletBase cmdlet, object[] outputObjectCollection)
        {
            BeforeWriteCollection(cmdlet, outputObjectCollection);

            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }

            for (int i = 0; i < outputObjectCollection.Length; i++)
            {
                writeSingleObject(cmdlet, outputObjectCollection[i]);
            }

            AfterWriteCollection(cmdlet, outputObjectCollection);
        }
Exemplo n.º 7
0
        public virtual void WriteObject(PSCmdletBase cmdlet, ICollection outputObjectCollection)
        {
            BeforeWriteCollection(cmdlet, outputObjectCollection);

            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }
            foreach (var outputObject in outputObjectCollection)
            {
// this.WriteVerbose(this, "something to output!!!!!!!!!!1");
                //WriteObject(cmdlet, outputObject);
                writeSingleObject(cmdlet, outputObject);
            }

            AfterWriteCollection(cmdlet, outputObjectCollection);
        }
Exemplo n.º 8
0
        public virtual void WriteObject(PSCmdletBase cmdlet, IEnumerable outputObjectCollection)
        {
            BeforeWriteCollection(cmdlet, outputObjectCollection);

            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }
            IEnumerator en = outputObjectCollection.GetEnumerator();

            while (en.MoveNext())
            {
                writeSingleObject(cmdlet, en.Current);
            }

            AfterWriteCollection(cmdlet, outputObjectCollection);
        }
Exemplo n.º 9
0
        public virtual void WriteObject(PSCmdletBase cmdlet, ArrayList outputObjectCollection)
        {
            BeforeWriteCollection(cmdlet, outputObjectCollection);

            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                //UnitTestOutput.Add(outputObjectCollection);
                UnitTestOutput.StartAddingOutput();
            }

            for (int i = 0; i < outputObjectCollection.Count; i++)
            {
                WriteObject(cmdlet, outputObjectCollection[i]);
            }

            AfterWriteCollection(cmdlet, outputObjectCollection);
        }
Exemplo n.º 10
0
        public virtual void WriteObject(PSCmdletBase cmdlet, List <object> outputObjectCollection)
        {
            BeforeWriteCollection(cmdlet, outputObjectCollection);

            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();

                UnitTestOutput.StartAddingOutput();
            }
            // 20121117
            //for (int i = 0; i < outputObjectCollection.Count; i++) {
            foreach (var item in outputObjectCollection)
            {
                writeSingleObject(cmdlet, item);
            }
            //}

            AfterWriteCollection(cmdlet, outputObjectCollection);
        }
Exemplo n.º 11
0
        public void WriteError(PSCmdletBase cmdlet, string message, string errorId, ErrorCategory category, bool terminating)
        {
            if (UnitTestMode)
            {
                UnitTestOutput.CheckInitialized();
                UnitTestOutput.StartAddingOutput();
            }

            var err =
                new ErrorRecord(
                    new Exception(message),
                    errorId,
                    category,
                    null);

            err.ErrorDetails =
                new ErrorDetails(message);

            //WriteError(cmdlet, err, terminating);
            writeSingleError(cmdlet, err, terminating);
        }