/// <summary>
        /// Gets the N unit test args.
        /// </summary>
        /// <param name="sessionInfo">The session info.</param>
        /// <param name="testAssemblyConfig">The test assembly config.</param>
        /// <returns></returns>
        private static string GetNUnitTestArgs(SessionInfo sessionInfo, TestAssemblyConfig testAssemblyConfig)
        {
            StringBuilder nunitArgsBuilder = new StringBuilder();

            string testAssemblyPath = testAssemblyConfig.AssemblyPath;

            nunitArgsBuilder.AppendFormat("\"{0}\" ", testAssemblyPath);

            StringBuilder nunitTestBuilder = new StringBuilder();

            bool firstTest = true;

            foreach (string testToRun in sessionInfo.CommandLineArguments.TestsToRun)
            {
                if (!firstTest)
                {
                    nunitTestBuilder.Append(",");
                }
                nunitTestBuilder.AppendFormat("{0}", testToRun);
                firstTest = false;
            }

            if (sessionInfo.TestCodeContext != null)
            {
                if (sessionInfo.TestCodeContext.IsValid)
                {
                    if (!firstTest)
                    {
                        nunitTestBuilder.Append(",");
                    }
                    nunitTestBuilder.AppendFormat("{0}", sessionInfo.TestCodeContext.ToString());
                }
                else
                {
                    throw new InvalidOperationException("The test context is invalid.");
                }
            }

            if (nunitTestBuilder.Length > 0)
            {
                nunitArgsBuilder.AppendFormat("/run:\"{0}\" ", nunitTestBuilder.ToString());
            }

            if (!string.IsNullOrEmpty(sessionInfo.CommandLineArguments.Category))
            {
                nunitArgsBuilder.AppendFormat("/include:\"{0}\" ", sessionInfo.CommandLineArguments.Category);
            }

            if (sessionInfo.NoResults)
            {
                nunitArgsBuilder.AppendFormat("/noresult ");
            }
            else
            {
                string nunitResultsFile = Path.Combine(sessionInfo.ResultsDirectory, string.Format(OpenCoverNunitTestResultsFileName, Path.GetFileNameWithoutExtension(testAssemblyConfig.AssemblyPath)));
                nunitArgsBuilder.AppendFormat("/result:\"{0}\" ", nunitResultsFile);
            }

            nunitArgsBuilder = nunitArgsBuilder.Replace("\"", "\\\"");

            return(nunitArgsBuilder.ToString());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="OpenCoverCommandExecutor"/> class.
 /// </summary>
 /// <param name="sessionInfo">The session info.</param>
 public OpenCoverCommandExecutor(SessionInfo sessionInfo)
     : base(sessionInfo)
 {
 }