public void Test_FileCopyQueueConsumer_ValidMessage_IsAcked() { BasicDeliverEventArgs mockDeliverArgs = GetMockDeliverArgs(_message); var consumer = new FileCopyQueueConsumer(_mockFileCopier.Object); consumer.SetModel(_mockModel.Object); consumer.ProcessMessage(mockDeliverArgs); new TestTimelineAwaiter().Await(() => consumer.AckCount == 1 && consumer.NackCount == 0); }
public void Test_FileCopyQueueConsumer_ApplicationException_IsNacked() { BasicDeliverEventArgs mockDeliverArgs = GetMockDeliverArgs(_message); _mockFileCopier.Reset(); _mockFileCopier.Setup(x => x.ProcessMessage(It.IsAny <ExtractFileMessage>(), It.IsAny <IMessageHeader>())).Throws <ApplicationException>(); var consumer = new FileCopyQueueConsumer(_mockFileCopier.Object); consumer.SetModel(_mockModel.Object); consumer.ProcessMessage(mockDeliverArgs); new TestTimelineAwaiter().Await(() => consumer.AckCount == 0 && consumer.NackCount == 1); }
public void Test_FileCopyQueueConsumer_UnknownException_CallsFatalCallback() { BasicDeliverEventArgs mockDeliverArgs = GetMockDeliverArgs(_message); _mockFileCopier.Reset(); _mockFileCopier.Setup(x => x.ProcessMessage(It.IsAny <ExtractFileMessage>(), It.IsAny <IMessageHeader>())).Throws <Exception>(); var consumer = new FileCopyQueueConsumer(_mockFileCopier.Object); consumer.SetModel(_mockModel.Object); var fatalCalled = false; consumer.OnFatal += (sender, _) => fatalCalled = true; consumer.ProcessMessage(mockDeliverArgs); new TestTimelineAwaiter().Await(() => fatalCalled, "Expected Fatal to be called"); Assert.AreEqual(0, consumer.AckCount); Assert.AreEqual(0, consumer.NackCount); }