Пример #1
0
 public void Test()
 {
     Channel.Subscribe(ClientFiber,
                       s =>
     {
         Received = s;
         RcvdSignal.Set();
     });
     Thread.Sleep(10);
     Send.Publish("test");
     RcvdSignal.WaitOne(TimeSpan.FromSeconds(1));
     Cleanup();
     Received.Should().BeEquivalentTo("test");
 }
Пример #2
0
        public void Test()
        {
            Channel.Subscribe(ClientFiber,
                              s =>
            {
                Received = s;
                if (s == "test999999")
                {
                    RcvdSignal.Set();
                }
            });
            Stopwatch sw = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                Push.Publish("test" + i);
            }
            RcvdSignal.WaitOne(TimeSpan.FromSeconds(5));
            sw.Stop();
            Cleanup();
            Console.WriteLine("Elapsed: " + sw.ElapsedMilliseconds);
            Received.Should().BeEquivalentTo("test999999");
        }