internal void Parse(string value, ReportArchive.ReportArchiveValue expectedMode)
        {
            ReportArchive actualMode = ReportArchive.Parse(value);

            Assert.AreEqual(expectedMode, actualMode.Value);
        }
Beispiel #2
0
        internal static void ConfigureLauncherFromArguments(TestLauncher launcher, EchoArguments arguments)
        {
            launcher.RuntimeSetup = new RuntimeSetup();
            GenericCollectionUtils.ForEach(arguments.PluginDirectories, x => launcher.RuntimeSetup.AddPluginDirectory(x));

            if (arguments.ShadowCopy.HasValue)
            {
                launcher.TestProject.TestPackage.ShadowCopy = arguments.ShadowCopy.Value;
            }

            if (arguments.Debug.HasValue && arguments.Debug.Value)
            {
                launcher.TestProject.TestPackage.DebuggerSetup = new DebuggerSetup();
            }

            if (arguments.ApplicationBaseDirectory != null)
            {
                launcher.TestProject.TestPackage.ApplicationBaseDirectory = new DirectoryInfo(arguments.ApplicationBaseDirectory);
            }

            if (arguments.WorkingDirectory != null)
            {
                launcher.TestProject.TestPackage.WorkingDirectory = new DirectoryInfo(arguments.WorkingDirectory);
            }

            if (arguments.RuntimeVersion != null)
            {
                launcher.TestProject.TestPackage.RuntimeVersion = arguments.RuntimeVersion;
            }

            GenericCollectionUtils.ForEach(arguments.Files, launcher.AddFilePattern);

            foreach (string hintDirectory in arguments.HintDirectories)
            {
                launcher.TestProject.TestPackage.AddHintDirectory(new DirectoryInfo(hintDirectory));
            }

            if (arguments.ReportDirectory != null)
            {
                launcher.TestProject.ReportDirectory = arguments.ReportDirectory;
            }

            if (arguments.ReportNameFormat != null)
            {
                launcher.TestProject.ReportNameFormat = arguments.ReportNameFormat;
            }

            launcher.TestProject.ReportArchive = ReportArchive.Parse(arguments.ReportArchive);
            GenericCollectionUtils.ForEach(arguments.ReportTypes, launcher.AddReportFormat);

            if (arguments.RunnerType != null)
            {
                launcher.TestProject.TestRunnerFactoryName = arguments.RunnerType;
            }
            GenericCollectionUtils.ForEach(arguments.RunnerExtensions, x => launcher.TestProject.AddTestRunnerExtensionSpecification(x));

            foreach (string option in arguments.ReportFormatterProperties)
            {
                KeyValuePair <string, string> pair = StringUtils.ParseKeyValuePair(option);
                launcher.ReportFormatterOptions.AddProperty(pair.Key, pair.Value);
            }

            foreach (string option in arguments.RunnerProperties)
            {
                KeyValuePair <string, string> pair = StringUtils.ParseKeyValuePair(option);
                launcher.TestRunnerOptions.AddProperty(pair.Key, pair.Value);
            }

            launcher.DoNotRun          = arguments.DoNotRun;
            launcher.IgnoreAnnotations = arguments.IgnoreAnnotations;

            if (!String.IsNullOrEmpty(arguments.Filter))
            {
                launcher.TestExecutionOptions.FilterSet = FilterUtils.ParseTestFilterSet(arguments.Filter);
            }

            launcher.EchoResults = !arguments.NoEchoResults;
            launcher.ShowReports = arguments.ShowReports;

            if (arguments.RunTimeLimitInSeconds >= 0)
            {
                launcher.RunTimeLimit = TimeSpan.FromSeconds(arguments.RunTimeLimitInSeconds);
            }
        }