private void CreateOrOverwriteRunSettings(IRunSettingsProvider runSettingsProvider, string[] args)
        {
            var length = args.Length;

            for (int index = 0; index < length; index++)
            {
                var keyValuePair     = args[index];
                var indexOfSeparator = keyValuePair.IndexOf("=");
                if (indexOfSeparator <= 0 || indexOfSeparator >= keyValuePair.Length - 1)
                {
                    continue;
                }
                var key   = keyValuePair.Substring(0, indexOfSeparator).Trim();
                var value = keyValuePair.Substring(indexOfSeparator + 1);

                if (string.IsNullOrWhiteSpace(key))
                {
                    continue;
                }

                // To determine whether to infer framework and platform.
                UpdateFrameworkAndPlatform(key, value);

                runSettingsProvider.UpdateRunSettingsNode(key, value);
            }
        }
        private void CreateOrOverwriteRunSettings(IRunSettingsProvider runSettingsProvider, string[] args)
        {
            var mergedArgs = new List <string>();
            var mergedArg  = string.Empty;
            var merge      = false;

            foreach (var arg in args)
            {
                // when we see that the parameter begins with TestRunParameters
                // but does not end with ") we start merging the params
                if (arg.StartsWith("TestRunParameters", StringComparison.OrdinalIgnoreCase))
                {
                    if (arg.EndsWith("\")"))
                    {
                        // this parameter is complete
                        mergedArgs.Add(arg);
                    }
                    else
                    {
                        // this parameter needs merging
                        merge = true;
                    }
                }

                // we merge as long as the flag is set
                // hoping that we find the end of the parameter
                if (merge)
                {
                    mergedArg += string.IsNullOrWhiteSpace(mergedArg) ? arg : $" {arg}";
                }
                else
                {
                    // if we are not merging just pass the param as is
                    mergedArgs.Add(arg);
                }

                // once we detect the end we add the whole parameter to the args
                if (merge && arg.EndsWith("\")"))
                {
                    mergedArgs.Add(mergedArg);
                    mergedArg = string.Empty;
                    merge     = false;
                }
            }

            if (merge)
            {
                // we tried to merge but never found the end of that
                // test paramter, add what we merged up until now
                mergedArgs.Add(mergedArg);
            }


            var length = mergedArgs.Count;

            for (int index = 0; index < length; index++)
            {
                var arg = mergedArgs[index];

                if (UpdateTestRunParameterNode(runSettingsProvider, arg))
                {
                    continue;
                }

                var indexOfSeparator = arg.IndexOf("=");

                if (indexOfSeparator <= 0 || indexOfSeparator >= arg.Length - 1)
                {
                    continue;
                }

                var key   = arg.Substring(0, indexOfSeparator).Trim();
                var value = arg.Substring(indexOfSeparator + 1);

                if (string.IsNullOrWhiteSpace(key))
                {
                    continue;
                }

                // To determine whether to infer framework and platform.
                UpdateFrameworkAndPlatform(key, value);

                runSettingsProvider.UpdateRunSettingsNode(key, value);
            }
        }