public void MessageQueue_Add_MessageCounterSignal_IsSet_true() { var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); Assert.IsTrue(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_AddRange_fires_MessageFrameAdded() { var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); MessageFrame messageFrame = null; messageQueue.MessageFrameAdded += m => { messageFrame = m; }; messageQueue.AddRange(new [] { testMessageFrame }); Assert.AreSame(testMessageFrame, messageFrame); }
public void MessageQueue_Add_single_message_SendFromQueue_message_writer_receives_message() { var messageFramesWritten = new List<MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); messageQueue.SendFromQueue(messageFramesWriter); Assert.AreSame(testMessageFrame, messageFramesWritten.First()); }
public void MessageQueue_Add_single_message_SendFromQueueAsync_fails_MessageCounterSignal_IsSet_true() { var errorMessageFrameWriter = CreateMessageFrameWriterThrowsIOException(); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); Assert.Throws <AggregateException>(() => messageQueue.SendFromQueueAsync(errorMessageFrameWriter, CancellationToken.None).Wait()); Assert.IsTrue(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_Add_single_message_SendFromQueue_fails_MessageCounterSignal_IsSet_true() { var errorMessageFrameWriter = CreateMessageFrameWriterThrowsIOException(); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); Assert.Throws <IOException>(() => messageQueue.SendFromQueue(errorMessageFrameWriter)); Assert.IsTrue(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_Add_single_message_SendFromQueue_MessageCounterSignal_IsSet_false() { var messageFramesWritten = new List <MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); messageQueue.SendFromQueue(messageFramesWriter); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_Add_single_message_SendFromQueue_message_writer_receives_message() { var messageFramesWritten = new List <MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); messageQueue.SendFromQueue(messageFramesWriter); Assert.AreSame(testMessageFrame, messageFramesWritten.First()); }
public void MessageQueue_AddRange_two_messages_after_SendFromQueueAsync_MessageCounterSignal_IsSet_true() { var messageFramesWritten = new List <MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.AddRange(new[] { testMessageFrame, testMessageFrame }); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); Assert.IsTrue(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_Add_single_message_SendFromQueueAsync_MessageCounterSignal_IsSet_false() { var messageFramesWritten = new List <MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_AddRange_two_messages_SendFromQueueAsync_writer_receive_first_message() { var messageFramesWritten = new List <MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame1 = new MessageFrame(); var testMessageFrame2 = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.AddRange(new[] { testMessageFrame1, testMessageFrame2 }); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); Assert.AreSame(testMessageFrame1, messageFramesWritten.Single()); }
public void MessageQueue_AddRange_two_messages_after_SendFromQueue_twice_MessageCounterSignal_IsSet_false() { var messageFramesWritten = new List <MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.AddRange(new[] { testMessageFrame, testMessageFrame }); messageQueue.SendFromQueue(messageFramesWriter); messageQueue.SendFromQueue(messageFramesWriter); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_Add_single_message_SendFromQueue_fails_once_then_succeeds_MessageCounterSignal_IsSet_false() { var errorMessageFrameWriter = CreateMessageFrameWriterThrowsIOException(); var messageFramesWritten = new List <MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); Assert.Throws <IOException>(() => messageQueue.SendFromQueue(errorMessageFrameWriter)); messageQueue.SendFromQueue(messageFramesWriter); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_AddRange_two_messages_SendFromQueue_twice_writer_receives_both_messages() { var messageFramesWritten = new List <MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame1 = new MessageFrame(); var testMessageFrame2 = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.AddRange(new[] { testMessageFrame1, testMessageFrame2 }); messageQueue.SendFromQueue(messageFramesWriter); messageQueue.SendFromQueue(messageFramesWriter); Assert.AreSame(testMessageFrame1, messageFramesWritten.First()); Assert.AreSame(testMessageFrame2, messageFramesWritten.Skip(1).Single()); }
public void MessageQueue_AddRange_two_messages_after_SendFromQueue_MessageCounterSignal_IsSet_true() { var messageFramesWritten = new List<MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.AddRange(new[] { testMessageFrame, testMessageFrame }); messageQueue.SendFromQueue(messageFramesWriter); Assert.IsTrue(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_Add_single_message_SendFromQueueAsync_MessageCounterSignal_IsSet_false() { var messageFramesWritten = new List<MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_empty_MessageCounterSignal_IsSet_false() { var messageQueue = new MessageQueueSingle(); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_Add_single_message_SendFromQueueAsync_fails_once_then_succeeds_MessageCounterSignal_IsSet_false() { var errorMessageFrameWriter = CreateMessageFrameWriterThrowsIOException(); var messageFramesWritten = new List<MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); Assert.Throws<AggregateException>(() => messageQueue.SendFromQueueAsync(errorMessageFrameWriter, CancellationToken.None).Wait()); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_AddRange_two_messages_SendFromQueue_writer_receive_first_message() { var messageFramesWritten = new List<MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame1 = new MessageFrame(); var testMessageFrame2 = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.AddRange(new[] { testMessageFrame1, testMessageFrame2 }); messageQueue.SendFromQueue(messageFramesWriter); Assert.AreSame(testMessageFrame1, messageFramesWritten.Single()); }
public void MessageQueue_Add_single_message_SendFromQueue_MessageCounterSignal_IsSet_false() { var messageFramesWritten = new List<MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); messageQueue.SendFromQueue(messageFramesWriter); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_AddRange_two_messages_SendFromQueueAsync_twice_writer_receives_both_messages() { var messageFramesWritten = new List<MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame1 = new MessageFrame(); var testMessageFrame2 = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.AddRange(new[] { testMessageFrame1, testMessageFrame2 }); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); Assert.AreSame(testMessageFrame1, messageFramesWritten.First()); Assert.AreSame(testMessageFrame2, messageFramesWritten.Skip(1).Single()); }
public void MessageQueue_Add_single_message_SendFromQueue_fails_MessageCounterSignal_IsSet_true() { var errorMessageFrameWriter = CreateMessageFrameWriterThrowsIOException(); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.Add(testMessageFrame); Assert.Throws<IOException>(() => messageQueue.SendFromQueue(errorMessageFrameWriter)); Assert.IsTrue(messageQueue.MessageCounterSignal.IsSet); }
public void MessageQueue_AddRange_two_messages_after_SendFromQueueAsync_twice_MessageCounterSignal_IsSet_false() { var messageFramesWritten = new List<MessageFrame>(); var messageFramesWriter = CreateMessageFrameWriter(messageFramesWritten); var testMessageFrame = new MessageFrame(); var messageQueue = new MessageQueueSingle(); messageQueue.AddRange(new[] { testMessageFrame, testMessageFrame }); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); messageQueue.SendFromQueueAsync(messageFramesWriter, CancellationToken.None).Wait(); Assert.IsFalse(messageQueue.MessageCounterSignal.IsSet); }