/// <summary>
        /// Replaces the window text.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="fromText">From text.</param>
        /// <param name="toText">To text.</param>
        /// <param name="closeWindow">if set to <c>true</c> [close window].</param>
        public static void ReplaceWindowText(
            this DTE2 instance,
            string fromText,
            string toText,
            bool closeWindow)
        {
            instance.ReplaceText(fromText, toText, true);

            if (closeWindow)
            {
                try
                {
                    instance.ActiveWindow.Close(vsSaveChanges.vsSaveChangesYes);
                }
                catch (Exception exception)
                {
                    TraceService.WriteError("Error closing window in ReplaceWindowText error:-" + exception.Message);
                }
            }
        }
        /// <summary>
        /// Implements the unit testing code snippet.
        /// </summary>
        /// <param name="codeSnippet">The code snippet.</param>
        /// <param name="codeFile">The code file.</param>
        /// <param name="removeHeader">if set to <c>true</c> [remove header].</param>
        /// <param name="removeComments">if set to <c>true</c> [remove comments].</param>
        /// <param name="formatFunctionParameters">if set to <c>true</c> [format function parameters].</param>
        public void ImplementUnitTestingCodeSnippet(
            CodeSnippet codeSnippet,
            string codeFile,
            bool removeHeader,
            bool removeComments,
            bool formatFunctionParameters)
        {
            this.ImplementCodeSnippet(
                codeSnippet,
                formatFunctionParameters);

            //// add in the reference to the plugin - doing this way means we don't need it in the xml files
            codeSnippet.UsingStatements.Add(codeFile);

            //// this really shouldn't be done - templates now have a mind of their own - please fix!!
            DTE2 dte2 = this.projectItem.ContainingProject.DTE as DTE2;

            //// change the testable placeholders!
            string instanceName = "this." + codeFile.Substring(0, 1).ToLower() + codeFile.Substring(1);
            bool   replaced     = dte2.ReplaceText("this.TestableObject", instanceName, true);

            //// sometimes the find/replace doesnt work - god knows why - seems intermittent :-(
            if (replaced == false)
            {
                this.ReplaceText("this.TestableObject", instanceName);
            }

            if (removeHeader)
            {
                this.ProjectItem.RemoveHeader();
            }

            if (removeComments)
            {
                this.ProjectItem.RemoveComments();
            }
        }