Beispiel #1
0
        public void AddMessage_WhenMessageAdded_ExpectOnBuffer()
        {
            // Arrange
            var mockQueueWrapper           = new Mock <IQueueWrapper>();
            var mockQueueMessageSerializer = new Mock <IQueueMessageSerializer>();

            mockQueueMessageSerializer.Setup(r => r.GetVersionedMessage(It.IsAny <string>()))
            .Returns(new VersionedMessage());

            var buffer = new Buffer(this.LoggerFactory, mockQueueWrapper.Object, mockQueueMessageSerializer.Object);

            // Act
            var stopwatch = Stopwatch.StartNew();

            buffer.AddMessage("data");
            stopwatch.Stop();

            // Assert
            this.WriteTimeElapsed(stopwatch);

            var versionedMessages = buffer.InternalBuffer.ToList();

            Assert.That(versionedMessages.Count, Is.EqualTo(1));
        }