예제 #1
0
 public async Task MessageQueueTest02(IEnumerable <string> input, IEnumerable <string> expected)
 {
     using (var mq = new InteractiveWindowWriter.MessageQueue()) {
         foreach (var s in input)
         {
             mq.Enqueue(s, false);
         }
         var messages = (await mq.WaitForMessagesAsync(CancellationToken.None)).Select(m => m.Text);
         messages.Should().ContainInOrder(expected);
     }
 }
예제 #2
0
        public void MessageQueueTest01()
        {
            using (var mq = new InteractiveWindowWriter.MessageQueue()) {
                IEnumerable <InteractiveWindowWriter.Message> messages = null;

                var t = Task.Run(async() => {
                    messages = await mq.WaitForMessagesAsync(CancellationToken.None);
                });

                t.Wait(100);
                messages.Should().BeNull();

                mq.Enqueue("test", false);
                t.Wait();
                messages.Should().ContainSingle(m => m.Text == "test" && m.IsError == false);
            }
        }