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));
                    }
                }
            }
        }
Esempio n. 2
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);
             }
         }
     }
 }