public void TestTwoFibers() { FiberTester.TestPubSubWExtraFiber(ThreadFiber.StartNew(), ThreadFiber.StartNew()); FiberTester.TestPubSubWExtraFiber(PoolFiber.StartNew(), ThreadFiber.StartNew()); FiberTester.TestPubSubWExtraFiber(PoolFiber.StartNew(), PoolFiber.StartNew()); FiberTester.TestPubSubWExtraFiber(PoolFiber.StartNew(), StubFiber.StartNew()); }
public void OnlyOneConsumer() { using (var queues = new Disposables()) { IChannel <int> channel = new QueueChannel <int>(); ConcurrentBag <int> results = new ConcurrentBag <int>(); void OnReceive(int message) { results.Add(message); } //Init executing Fibers for (int i = 0; i < 10; i++) { IFiber threadFiber = ThreadFiber.StartNew(); queues.Add(threadFiber); channel.Subscribe(threadFiber, OnReceive); } //Push messages for (int i = 0; i < 1000000; i++) { channel.Publish(i); } Thread.Sleep(100); Assert.AreEqual(1000000, results.Count); var r1 = results.OrderBy(x => x).ToArray(); for (int i = 0; i < 1000000; i++) { Assert.AreEqual(i, r1[i]); } } }
public void TestBatching() { FiberTester.TestBatching(ThreadFiber.StartNew()); FiberTester.TestBatching(PoolFiber.StartNew()); FiberTester.TestBatching(StubFiber.StartNew()); FiberTester.TestBatchingWithKey(ThreadFiber.StartNew()); FiberTester.TestBatchingWithKey(PoolFiber.StartNew()); FiberTester.TestBatchingWithKey(StubFiber.StartNew()); }
public void TestReqReply() { FiberTester.TestReqReply1(ThreadFiber.StartNew()); FiberTester.TestReqReply1(PoolFiber.StartNew()); FiberTester.TestReqReply1(StubFiber.StartNew()); }
public void TestPubSubWithFilter() { FiberTester.TestPubSubWithFilter(ThreadFiber.StartNew()); FiberTester.TestPubSubWithFilter(PoolFiber.StartNew()); FiberTester.TestPubSubWithFilter(StubFiber.StartNew()); }
public void TestPubSubSimple() { FiberTester.TestPubSubSimple(ThreadFiber.StartNew()); FiberTester.TestPubSubSimple(PoolFiber.StartNew()); FiberTester.TestPubSubSimple(StubFiber.StartNew()); }
public void InOrderExecution() { FiberTester.InOrderExecution(ThreadFiber.StartNew()); FiberTester.InOrderExecution(PoolFiber.StartNew()); FiberTester.InOrderExecution(StubFiber.StartNew()); }