public void CallsRecordOnTheCurrentResultBuilder() { var mockResultBuilder = new Mock <IMessageResponseCollector>(); var mrh = new MessageResponseHandler(); mrh.EnqueueMessage(new PullAllMessage(), mockResultBuilder.Object); mrh.HandleSuccessMessage(new Dictionary <string, object> { { "fields", new List <object> { "x" } } }); mrh.HandleRecordMessage(new object[] { "x" }); mockResultBuilder.Verify(x => x.CollectRecord(It.IsAny <object[]>()), Times.Once); }
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.HandleSuccessMessage(new Dictionary <string, object> { { "fields", new List <object> { "x" } } }); mockLogger.ResetCalls(); mrh.HandleRecordMessage(new object[] { "x" }); mockLogger.Verify(x => x.Debug(It.Is <string>(actual => actual.StartsWith("S: ")), It.Is <object[]>(actual => actual.First() is RecordMessage)), Times.Once); }
public void HandleRecordMessage(object[] fields) { _messageHandler.HandleRecordMessage(fields); }