Esempio n. 1
0
        public void CreateAndUseQueueChannel()
        {
            QueueChannel channel = new QueueChannel(1);

            Thread thread = new Thread(new ThreadStart(delegate { channel.Send(10); }));
            thread.Start();

            object result = channel.Receive();
        }
Esempio n. 2
0
        public void CreateAndUseQueueChannelWithTenElements()
        {
            QueueChannel channel = new QueueChannel(10);

            for (int k = 1; k <= 10; k++)
                channel.Send(k);

            for (int k = 1; k <= 10; k++)
                Assert.AreEqual(k, channel.Receive());
        }
Esempio n. 3
0
        public void CreateAndUseQueueChannelTenTimes()
        {
            QueueChannel channel = new QueueChannel(1);

            Thread thread = new Thread(new ThreadStart(delegate { for (int k = 1; k <= 10; k++) channel.Send(k); }));
            thread.Start();

            for (int j = 1; j <= 10; j++)
                Assert.AreEqual(j, channel.Receive());
        }
Esempio n. 4
0
        public void CreateAndUseQueueChannelWithMoreEntriesThanSize()
        {
            QueueChannel channel = new QueueChannel(10);

            Thread thread = new Thread(new ThreadStart(delegate
            {
                for (int k = 1; k <= 20; k++)
                    channel.Send(k);
            }));

            thread.Start();

            for (int k = 1; k <= 20; k++)
                Assert.AreEqual(k, channel.Receive());
        }