Ejemplo n.º 1
0
        public void ExecutionExtension_ValidationSummary()
        {
            string msg1 = "message1",
                   msg2 = "message2",
                   msg3 = "message3";

            var er = new ExecutionResult("ss", null);

            er.Add(new[]
            {
                ValidationStep.BuildValidationResponseStep(true, msg1),
                ValidationStep.BuildValidationResponseStep(false, msg2),
                ValidationStep.BuildValidationResponseStep(false, msg3)
            });
            var vs1 = er.ValidationSummary();

            vs1.Count().ShouldBe(3);
            vs1.Contains(msg1).ShouldBeTrue();
            vs1.Contains(msg2).ShouldBeTrue();
            vs1.Contains(msg3).ShouldBeTrue();

            var vs2 = er.ValidationSummary(true);

            vs2.Count().ShouldBe(1);
            vs2.Contains(msg1).ShouldBeTrue();

            var vs3 = er.ValidationSummary(false);

            vs3.Count().ShouldBe(2);
            vs3.Contains(msg2).ShouldBeTrue();
            vs3.Contains(msg3).ShouldBeTrue();
        }
Ejemplo n.º 2
0
        static ExecutionResult Execute(CommandLineParser commandLineParser)
        {
            var options = commandLineParser.Options;

            var summary = new ExecutionResult();

            var stopwatch = new Stopwatch();

            stopwatch.Start();

            foreach (var assemblyPath in commandLineParser.AssemblyPaths)
            {
                var result = Execute(assemblyPath, options);

                summary.Add(result);
            }

            stopwatch.Stop();

            if (summary.AssemblyResults.Count > 1)
            {
                Summarize(summary, stopwatch.Elapsed);
            }

            SaveReport(options, summary);

            return(summary);
        }
Ejemplo n.º 3
0
        public void ExecutionExtension_AddValidationStep()
        {
            var er1 = new ExecutionResult("ss", null);

            er1.Add(ValidationStep.BuildValidationResponseStep(false, "message"));
            er1.ValidationSteps.Any().ShouldBeTrue();
        }
Ejemplo n.º 4
0
        public void ExecutionExtension_AddExecutionResultStep()
        {
            var er1 = new ExecutionResult("ss", null);

            er1.Add(ExecutionResultStep.Build(ExecutionStatus.Passed, "message"));
            er1.ExecutionResultSteps.Any().ShouldBeTrue();
        }
Ejemplo n.º 5
0
        public void ExecutionExtension_executionSummary()
        {
            string msg1 = "message1",
                   msg2 = "message2",
                   msg3 = "message3";

            var er = new ExecutionResult("ss", null);

            er.Add(new[]
            {
                ExecutionResultStep.Build(ExecutionStatus.Passed, msg1),
                ExecutionResultStep.Build(ExecutionStatus.Failed, msg2),
                ExecutionResultStep.Build(ExecutionStatus.Failed, msg3)
            });
            var es1 = er.ExecutionSummary();

            es1.Count().ShouldBe(3);
            es1.Contains(msg1).ShouldBeTrue();
            es1.Contains(msg2).ShouldBeTrue();
            es1.Contains(msg3).ShouldBeTrue();

            var es2 = er.ExecutionSummary(ExecutionStatus.Passed);

            es2.Count().ShouldBe(1);
            es2.Contains(msg1).ShouldBeTrue();

            var es3 = er.ExecutionSummary(ExecutionStatus.Failed);

            es3.Count().ShouldBe(2);
            es3.Contains(msg2).ShouldBeTrue();
            es3.Contains(msg3).ShouldBeTrue();
        }
Ejemplo n.º 6
0
        public void ExecutionExtension_AddValidationStepCollection()
        {
            var er1 = new ExecutionResult("ss", null);

            er1.Add(new[]
            {
                ValidationStep.BuildValidationResponseStep(false, "message"),
                ValidationStep.BuildValidationResponseStep(false, "message"),
                ValidationStep.BuildValidationResponseStep(false, "message")
            });
            er1.ValidationSteps.Count.ShouldBe(3);
        }
Ejemplo n.º 7
0
        public void ExecutionExtension_AddExecutionResultStepCollection()
        {
            var er1 = new ExecutionResult("ss", null);

            er1.Add(new[]
            {
                ExecutionResultStep.Build(ExecutionStatus.Passed, "message"),
                ExecutionResultStep.Build(ExecutionStatus.Passed, "message"),
                ExecutionResultStep.Build(ExecutionStatus.Passed, "message"),
            });

            er1.ExecutionResultSteps.Count.ShouldBe(3);
        }
Ejemplo n.º 8
0
        static int Main(string[] args)
        {
            try
            {
                var commandLineParser = new CommandLineParser(args);

                if (commandLineParser.HasErrors)
                {
                    using (Foreground.Red)
                        foreach (var error in commandLineParser.Errors)
                        {
                            Console.WriteLine(error);
                        }

                    Console.WriteLine("Usage: Fixie.Console [custom-options] assembly-path...");
                    return(FatalError);
                }

                var executionResult = new ExecutionResult();

                var stopwatch = new Stopwatch();
                stopwatch.Start();

                foreach (var assemblyPath in commandLineParser.AssemblyPaths)
                {
                    var result = Execute(assemblyPath, args);

                    executionResult.Add(result);
                }

                stopwatch.Stop();

                if (executionResult.AssemblyResults.Count > 1)
                {
                    Summarize(executionResult, stopwatch.Elapsed);
                }

                ProduceReports(commandLineParser.Options, executionResult);

                return(executionResult.Failed);
            }
            catch (Exception exception)
            {
                using (Foreground.Red)
                    Console.WriteLine("Fatal Error: {0}", exception);
                return(FatalError);
            }
        }
Ejemplo n.º 9
0
        public void ShouldProduceValidXmlDocument()
        {
            var listener = new StubListener();
            var runner   = new Runner(listener);

            var executionResult = new ExecutionResult();
            var convention      = SelfTestConvention.Build();

            convention.CaseExecution.Skip(x => x.Method.Has <SkipAttribute>(), x => x.Method.GetCustomAttribute <SkipAttribute>().Reason);
            convention.Parameters.Add <InputAttributeParameterSource>();
            var assemblyResult = runner.RunTypes(GetType().Assembly, convention, typeof(PassFailTestClass));

            executionResult.Add(assemblyResult);

            var report = new NUnitXmlReport();
            var actual = report.Transform(executionResult);

            XsdValidate(actual);
            CleanBrittleValues(actual.ToString(SaveOptions.DisableFormatting)).ShouldEqual(ExpectedReport);
        }
Ejemplo n.º 10
0
        static int Main(string[] args)
        {
            try
            {
                var commandLineParser = new CommandLineParser(args);

                if (commandLineParser.HasErrors)
                {
                    using (Foreground.Red)
                        foreach (var error in commandLineParser.Errors)
                        {
                            Console.WriteLine(error);
                        }

                    Console.WriteLine();
                    Console.WriteLine(CommandLineParser.Usage());
                    return(FatalError);
                }

                foreach (var assemblyPath in commandLineParser.AssemblyPaths)
                {
                    if (!File.Exists(assemblyPath))
                    {
                        using (Foreground.Red)
                            Console.WriteLine("Specified test assembly does not exist: " + assemblyPath);

                        Console.WriteLine();
                        Console.WriteLine(CommandLineParser.Usage());
                        return(FatalError);
                    }
                }

                var executionResult = new ExecutionResult();

                var stopwatch = new Stopwatch();
                stopwatch.Start();

                foreach (var assemblyPath in commandLineParser.AssemblyPaths)
                {
                    var result = Execute(assemblyPath, commandLineParser.Options);

                    executionResult.Add(result);
                }

                stopwatch.Stop();

                if (executionResult.AssemblyResults.Count > 1)
                {
                    Summarize(executionResult, stopwatch.Elapsed);
                }

                ProduceReports(commandLineParser.Options, executionResult);

                return(executionResult.Failed);
            }
            catch (Exception exception)
            {
                using (Foreground.Red)
                    Console.WriteLine("Fatal Error: {0}", exception);
                return(FatalError);
            }
        }