示例#1
0
        private static void tryRunTests()
        {
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledExceptionHandler;
            using (var junction = new PipeJunction(_arguments.Channel))
            {
                try
                {
                    var parser = new OptionsXmlReader(_arguments.InputFile);
                    parser.Parse();
                    if (!parser.IsValid)
                        return;

                    run(parser, junction);

                    var writer = new ResultsXmlWriter(_results);
                    writer.Write(_arguments.OutputFile);
                }
                catch (Exception ex)
                {
                    try
                    {
                        var result = new List<TestResult>();
                        result.Add(ErrorHandler.GetError("Init", ex));
                        var writer = new ResultsXmlWriter(result);
                        writer.Write(_arguments.OutputFile);
                    }
                    catch
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }
            }
            AppDomain.CurrentDomain.UnhandledException -= CurrentDomainUnhandledExceptionHandler;
        }
        public void client_receives_both_messages()
        {
            var pipe1 = Guid.NewGuid().ToString();
            var pipe2 = Guid.NewGuid().ToString();
            var pipe3 = Guid.NewGuid().ToString();
            using (var server1 = new PipeServer(pipe1))
            {
                using (var server2 = new PipeServer(pipe2))
                {
                    using (var junction = new PipeJunction(pipe3))
                    {
                        junction.Combine(pipe1);
                        junction.Combine(pipe2);
                        server1.Send("Message from server 1");
                        server2.Send("Message from server 2");

                        var messages = new List<string>();
                        var client = new PipeClient();
                        new System.Threading.Thread(() => client.Listen(pipe3, (m) => messages.Add(m))).Start();
                        Timeout.AfterTwoSeconds().IfNot(() => messages.Count == 2);
                        Assert.That(messages.Count, Is.EqualTo(2));
                    }
                }
            }
        }
示例#3
0
 private static void run(OptionsXmlReader parser, PipeJunction junction)
 {
     foreach (var plugin in getPlugins(parser))
     {
         var instance = plugin.New();
         foreach (var currentRuns in parser.Options.TestRuns.Where(x => x.ID.ToLower().Equals("any") || instance.Handles(x.ID)))
         {
             var run = getTestRunsFor(instance, currentRuns);
             if (run == null)
                 continue;
             foreach (var assembly in run.Assemblies)
             {
                 WriteNow("Running tests for " + assembly.Assembly + " using " + plugin.Type);
                 var pipeName = Guid.NewGuid().ToString();
                 junction.Combine(pipeName);
                 var process = new SubDomainRunner(plugin, run.ID, run.Categories, assembly, _arguments.Logging, pipeName, _arguments.CompatabilityMode);
                 process.Run(null);
             }
         }
     }
 }