Beispiel #1
0
        public void Logging_kafka_message_has_message_information()
        {
            var message = new ConsumeResult <string, string>
            {
                Topic   = "topic",
                Message = new Message <string, string>
                {
                    Key   = "key",
                    Value = "value"
                },
                Offset = 21
            };

            _sut.LogKafkaMessage(_eventId, "Test", message);

            var entry = _sut.LogEntries.Single(l => l.LogLevel == LogLevel.Debug && l.EventId.Id == 1);

            Assert.Equal("topic", entry.GetValue("Topic"));
            Assert.Equal("key", entry.GetValue("Key"));
            Assert.Equal("value", entry.GetValue("Value"));
            Assert.Equal(new Offset(21), entry.GetValue("Offset"));
        }