Esempio n. 1
0
        public void ShouldReportPassFailSkipCounts()
        {
            using (var console = new RedirectedConsole())
            {
                var listener = new ConsoleListener();
                var assembly = typeof(ConsoleListener).Assembly;
                var version = assembly.GetName().Version;

                var assemblyResult = new AssemblyResult(assembly.Location);
                var conventionResult = new ConventionResult("Fake Convention");
                var classResult = new ClassResult("Fake Class");
                assemblyResult.Add(conventionResult);
                conventionResult.Add(classResult);
                classResult.Add(CaseResult.Passed("A", TimeSpan.Zero));
                classResult.Add(CaseResult.Failed("B", TimeSpan.Zero, "Message", "Stack Trace", "Exception Type"));
                classResult.Add(CaseResult.Failed("C", TimeSpan.Zero, "Message", "Stack Trace", "Exception Type"));
                classResult.Add(CaseResult.Skipped("D", "Reason"));
                classResult.Add(CaseResult.Skipped("E", "Reason"));
                classResult.Add(CaseResult.Skipped("F", "Reason"));

                listener.AssemblyCompleted(assembly, assemblyResult);

                console.Lines().ShouldEqual("1 passed, 2 failed, 3 skipped, took 0.00 seconds (Fixie " + version + ").");
            }
        }
Esempio n. 2
0
        public void ShouldReportPassFailSkipCounts()
        {
            using (var console = new RedirectedConsole())
            {
                var listener = new ConsoleListener();
                var assembly = typeof(ConsoleListener).Assembly;
                var version = assembly.GetName().Version;

                var assemblyResult = new AssemblyResult(assembly.Location);
                var conventionResult = new ConventionResult("Fake Convention");
                var classResult = new ClassResult("Fake Class");
                assemblyResult.Add(conventionResult);
                conventionResult.Add(classResult);
                classResult.Add(CaseResult.Passed("A", TimeSpan.Zero));
                classResult.Add(CaseResult.Failed("B", TimeSpan.Zero, new ExceptionInfo(new Exception(), new AssertionLibraryFilter())));
                classResult.Add(CaseResult.Failed("C", TimeSpan.Zero, new ExceptionInfo(new Exception(), new AssertionLibraryFilter())));
                classResult.Add(CaseResult.Skipped("D", "Reason"));
                classResult.Add(CaseResult.Skipped("E", "Reason"));
                classResult.Add(CaseResult.Skipped("F", "Reason"));

                listener.AssemblyCompleted(assembly, assemblyResult);

                console.Lines().ShouldEqual(string.Format("1 passed, 2 failed, 3 skipped, took {0} seconds (Fixie {1}).",
                                                          0.ToString("N2", CultureInfo.CurrentCulture),
                                                          version));
            }
        }
Esempio n. 3
0
 static XElement Assembly(AssemblyResult assemblyResult)
 {
     return new XElement("test-suite",
         new XAttribute("success", assemblyResult.Failed == 0),
         new XAttribute("name", assemblyResult.Name),
         new XAttribute("time", Seconds(assemblyResult.Duration)),
         new XElement("results", assemblyResult.ConventionResults.Select(Convention)));
 }
Esempio n. 4
0
        static XElement TestSuiteElement(AssemblyResult assemblyResult)
        {
            var suite = new XElement("test-suite",
                new XAttribute("success", assemblyResult.Failed == 0),
                new XAttribute("name", assemblyResult.Name),
                new XAttribute("time", assemblyResult.Duration.TotalSeconds.ToString("0.000")));

            var results = new XElement("results");

            suite.Add(results);

            foreach (var conventionResult in assemblyResult.ConventionResults)
                results.Add(TestSuiteElement(conventionResult));

            return suite;
        }
Esempio n. 5
0
        public void AssemblyCompleted(Assembly assembly, AssemblyResult result)
        {
            var assemblyName = typeof(ConsoleListener).Assembly.GetName();
            var name = assemblyName.Name;
            var version = assemblyName.Version;

            var line = new StringBuilder();

            line.AppendFormat("{0} passed", result.Passed);
            line.AppendFormat(", {0} failed", result.Failed);

            if (result.Skipped > 0)
                line.AppendFormat(", {0} skipped", result.Skipped);

            line.AppendFormat(", took {0:N2} seconds", result.Duration.TotalSeconds);

            line.AppendFormat(" ({0} {1}).", name, version);
            Console.WriteLine(line);
            Console.WriteLine();
        }
Esempio n. 6
0
        static XElement Assembly(AssemblyResult assemblyResult)
        {
            var now = DateTime.UtcNow;

            var classResults = assemblyResult.ConventionResults.SelectMany(x => x.ClassResults);

            return new XElement("assembly",
                new XAttribute("name", assemblyResult.Name),
                new XAttribute("run-date", now.ToString("yyyy-MM-dd")),
                new XAttribute("run-time", now.ToString("HH:mm:ss")),
                new XAttribute("configFile", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile),
                new XAttribute("time", Seconds(assemblyResult.Duration)),
                new XAttribute("total", assemblyResult.Total),
                new XAttribute("passed", assemblyResult.Passed),
                new XAttribute("failed", assemblyResult.Failed),
                new XAttribute("skipped", assemblyResult.Skipped),
                new XAttribute("environment", String.Format("{0}-bit .NET {1}", IntPtr.Size * 8, Environment.Version)),
                new XAttribute("test-framework", string.Format("Fixie {0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version)),
                classResults.Select(Class));
        }
Esempio n. 7
0
 public void AssemblyCompleted(Assembly assembly, AssemblyResult result)
 {
     Message("testSuiteFinished name='{0}'", assembly.FileName());
 }
Esempio n. 8
0
 public void AssemblyCompleted(Assembly assembly, AssemblyResult result)
 {
 }
Esempio n. 9
0
 public void Add(AssemblyResult assemblyResult)
 {
     assemblyResults.Add(assemblyResult);
 }
Esempio n. 10
0
 public void Add(AssemblyResult assemblyResult)
 {
     assemblyResults.Add(assemblyResult);
 }