Ejemplo n.º 1
0
        public TestRunnerOptions(TestRunnerOptions copyFrom)
        {
            if (copyFrom == null)
            {
                return;
            }

            IgnoreFocus = copyFrom.IgnoreFocus;
            FixturePaths.AddAll(copyFrom.FixturePaths);
            LoaderPaths.AddAll(copyFrom.LoaderPaths);
            LoadAssemblyFromPath = copyFrom.LoadAssemblyFromPath;
            RandomSeed           = copyFrom.RandomSeed;
            _flags       = copyFrom._flags;
            ContextLines = copyFrom.ContextLines;
            SelfTest     = copyFrom.SelfTest;
            PackageReferences.AddAll(copyFrom.PackageReferences);
            PlanFilter.CopyFrom(copyFrom.PlanFilter);
            TestTimeout                = copyFrom.TestTimeout;
            PlanTimeout                = copyFrom.PlanTimeout;
            SlowTestThreshold          = copyFrom.SlowTestThreshold;
            AssertionMessageFormatMode = copyFrom.AssertionMessageFormatMode;
            PreviousRun                = copyFrom.PreviousRun;
        }
Ejemplo n.º 2
0
        private ProgramOptions()
        {
            OptionSet = new OptionSetExtension {
                { "help", SR.UHelp(), v => Action = ShowHelp },
                { "version", SR.UVersion(), v => Action = ShowVersion },

                { "i|fixture=", SR.UFixture(), v => FixturePaths.Add(v) },
                { "p|package=", SR.UPackage(), v => Packages.Add(SafeParsePackageFormula(v, SR.InvalidPackageReference(), "--package")) },
                { "loader-path=", SR.ULoaderPath(), v => LoaderPaths.Add(v) },
                { "no-config", SR.UNoConfig(), v => NoConfig = true },
                { "C|project-dir=", SR.UProjectDir(), v => ProjectDirectory = v },

                { "exclude=", SR.UExclude(), v => PlanFilter.Excludes.AddNew(v) },
                { "exclude-pattern=", SR.UExcludePattern(), v => PlanFilter.Excludes.AddRegex(SafeRegexParse(v, "--exclude-pattern")) },
                { "F|focus=", SR.UFocus(), v => PlanFilter.FocusPatterns.AddNew(v) },
                { "no-focus", SR.UNoFocus(), v => Options.IgnoreFocus = true },
                { "t|tag=", SR.UTag(), v => PlanFilter.Tags.AddNew(v) },
                { "e|include=", SR.UInclude(), v => PlanFilter.Includes.AddNew(v) },
                { "E|include-pattern=", SR.UIncludePattern(), v => PlanFilter.Includes.AddRegex(SafeRegexParse(v, "--include-pattern")) },

                { "show-whitespace", SR.UShowWhitespace(), v => ShowWhitespace = true },
                { "no-whitespace", SR.UNoWhitespace(), v => ShowWhitespace = false },
                { "full-stack-traces", SR.UFullStackTraces(), v => ShowFullStackTraces = true },
                { "no-diff", SR.UNoDiff(), v => ShowUnifiedDiff = false },
                { "context-lines=", SR.UContextLines(), v => Options.ContextLines = SafeInt32Parse(v, SR.InvalidContextLines(), "--context-lines") },
                { "no-summary", SR.UNoSummary(), v => Options.SuppressSummary = true },
                { "self-test", SR.USelfTest(), v => WillSelfTest() },
                { "show-tests", SR.UShowTestNames(), v => Options.ShowTestNames = true },
                { "fail-fast", SR.UFailFast(), v => Options.FailFast = true },
                { "fail-focused", SR.UFailFocused(), v => FailFocused = true },
                { "fail-pending", SR.UFailOnPending(), v => FailOnPending = true },

                { "show-pass-explicit", SR.UShowPassExplicit(), v => Options.ShowPassExplicitly = true },
                { "verify=", SR.UVerify(), v => Verify = SafeEnumParse <TestVerificationMode>(v, SR.InvalidVerify(), "--verify") },
                { "previous-failures", SR.UPreviousFailures(), v => Options.RerunPreviousFailures = true },

                { "no-random", SR.UNoRandomizeSpecs(), v => Options.RandomizeSpecs = false },
                { "random-seed=", SR.URandom(), v => Options.RandomSeed = SafeInt32Parse(v, SR.InvalidRandomSeed(), "--random-seed") },

                { "timeout=", SR.UTimeout(), v => Options.TestTimeout = SafeTimeSpanParse(v, SR.InvalidTimeSpan(), "--timeout") },
                { "plan-timeout=", SR.UPlanTimeout(), v => Options.PlanTimeout = SafeTimeSpanParse(v, SR.InvalidTimeSpan(), "--plan-timeout") },
                { "slow-test=", SR.USlowTest(), v => Options.SlowTestThreshold = SafeTimeSpanParse(v, SR.InvalidTimeSpan(), "--slow-test") },
                { "pause", SR.UPause(), v => DebugWait = true },
            };

            OptionSet.Group(SR.UOutputOptions(), sort: true,
                            "context-lines=",
                            "no-diff",
                            "no-summary",
                            "show-whitespace",
                            "no-whitespace",
                            "show-pass-explicit",
                            "show-tests",
                            "slow-test=",
                            "full-stack-traces"
                            );

            OptionSet.Group(SR.UTestSelectionOptions(), sort: true,
                            "F|focus=",
                            "no-focus",
                            "exclude=",
                            "exclude-pattern=",
                            "t|tag=",
                            "e|include=",
                            "E|include-pattern="
                            );

            OptionSet.Group(SR.URunnerOptions(), sort: true,
                            "plan-timeout=",
                            "timeout=",
                            "verify=",
                            "no-random",
                            "random-seed=",
                            "self-test",
                            "fail-fast",
                            "previous-failures",
                            "fail-focused",
                            "fail-pending",
                            "i|fixture=",
                            "p|package=",
                            "loader-path=",
                            "pause",
                            "no-config",
                            "C|project-dir"
                            );

            ShowUnifiedDiff     = true;
            ShowFullStackTraces = EnvironmentHelper.Debug;
            FixturePaths.AddAll(EnvironmentHelper.FixturePath);
            LoaderPaths.AddAll(EnvironmentHelper.LoaderPath);
        }