Example #1
0
            public void ShouldNoNPEIfCurrentResultBuilderIsNull()
            {
                var mrh = new MessageResponseHandler();

                mrh.EnqueueMessage(new PullAllMessage());
                mrh.HandleIgnoredMessage();
            }
Example #2
0
            public void ShouldCallDoneIgnoredIfCurrentResultBuilderNotNull()
            {
                var mockResultBuilder = new Mock <IMessageResponseCollector>();

                var mrh = new MessageResponseHandler();

                mrh.EnqueueMessage(new PullAllMessage(), mockResultBuilder.Object);
                mrh.HandleIgnoredMessage();

                mockResultBuilder.Verify(x => x.DoneIgnored(), Times.Once);
            }
Example #3
0
            public void LogsTheMessageToDebug()
            {
                var mockResultBuilder = new Mock <IMessageResponseCollector>();
                var mockLogger        = new Mock <ILogger>();

                var mrh = new MessageResponseHandler(mockLogger.Object);

                mrh.EnqueueMessage(new PullAllMessage(), mockResultBuilder.Object);
                mrh.HandleIgnoredMessage();

                mockLogger.Verify(x => x.Debug(It.Is <string>(actual => actual.StartsWith("S: ")), It.Is <object[]>(actual => actual.First() is IgnoredMessage)), Times.Once);
            }
Example #4
0
            public void DequeuesFromSentMessagesAndSetsCurrentBuilder()
            {
                var mockResultBuilder = new Mock <IMessageResponseCollector>();
                var mrh = new MessageResponseHandler();

                mrh.EnqueueMessage(new PullAllMessage(), mockResultBuilder.Object);
                mrh.SentMessages.Should().HaveCount(1);
                mrh.CurrentResponseCollector.Should().BeNull();
                mrh.HandleIgnoredMessage();
                mrh.SentMessages.Should().HaveCount(0);
                mrh.CurrentResponseCollector.Should().NotBeNull();
            }
Example #5
0
 public void HandleIgnoredMessage()
 {
     IgnoreMessageCalled++;
     _messageHandler.HandleIgnoredMessage();
 }