Inheritance: IJsonSerialize
Exemple #1
0
        static int Main(string[] args)
        {
            ConventionTestProcessor.CIResultOutput.Disable = true;

            var id = "net40-converage";

            var asms = new[]
                           {
                               Assembly.GetAssembly(typeof (BasicTests.Basic)),
                               Assembly.GetAssembly(typeof (ConstraintsTests.Basic)),
                               Assembly.GetAssembly(typeof (XunitTests.Basic)),
                               Assembly.GetAssembly(typeof (NunitTests.Basic)),
                               Assembly.GetAssembly(typeof (FsUnitTests.BasicTests)),

                           };

            var runner = Runner.Create(id, asms);
            var file = new ResultsFile();
            runner.RunAll(r =>
                              {
                                  string js = r.ToItemJson();
                                  var r2= Newtonsoft.Json.JsonConvert.DeserializeObject<Result>(js);
                                  file.Add(r2);
                              });
            var result =file.ToListJson();

            return ConventionTestProcessor.Program.VerifyJsonResults(new[]{result});
        }
Exemple #2
0
 public static void ToFiles(ResultsFile file, IDictionary<string, string> typesAndPaths)
 {
     foreach (var typeAndPath in typesAndPaths)
     {
         switch (typeAndPath.Key)
         {
             default:
                 File.WriteAllText(typeAndPath.Value, file.ToListJson());
                 break;
         }
     }
 }
Exemple #3
0
        public void WhenFinished(ResultsFile file)
        {
            var rt = new RunTests();

            rt.PrintOutAloneStart(_id);
            foreach (var r in file.Results)
            {
                rt.PrintOutAloneResults(r);
            }
            rt.PrintOutAloneEnd(_id, file);

            if (_outputs != null && _outputs.Any())
            {
                WriteResults.ToFiles(file, _outputs);
                Environment.ExitCode = file.HasError ? 1 : 0;
            }
        }
Exemple #4
0
 public void PrintOutAloneEnd(string id, ResultsFile file)
 {
     if (TeamCity)
     {
         Console.WriteLine("##teamcity[testSuiteStarted name='{0}']", id);
     }
     else
     {
         Console.WriteLine("Finished");
         Console.WriteLine();
         var resultCount = file.ResultCount;
         foreach (var kp in resultCount.OrderBy(it=>it.Key))
         {
             Console.WriteLine("  {0,-15}{1,4}", kp.Key, kp.Value);
         }
         Console.WriteLine("{0,-17}{1,4}", "Total",resultCount.Select(r => r.Value).Sum());
     }
 }
Exemple #5
0
        public ResultsFile RunAlone(string id, IEnumerable<string> dlls)
        {
            #if x64
            if(!Environment.Is64BitProcess)
                throw new Exception("This runner is expected to run 64bit");
            #endif

            #if SILVERLIGHT
            var am = dlls.Select(Assembly.Load).ToList();
            #else
            var am = dlls.Select(Assembly.LoadFile).ToList();
            #endif

            var runner = Runner.Create(id, am);
            PrintOutAloneStart(id);
            var file = new ResultsFile();
            runner.RunAll(r =>
                              {
                                  PrintOutAloneResults(r);
                                  file.Add(r);
                              });
            PrintOutAloneEnd(id,file);
            return file;
        }