public void AddMessage_ShouldAddMessagesToBuffer(
            Message message1,
            Message message2,
            MessageSender sut)
        {
            sut.Add(message1);
            sut.Add(message2);

            sut.UnsentMessageCount.Should().Be(2);
            sut.MessageBuffer.Should().Contain(message1);
            sut.MessageBuffer.Should().Contain(message2);
        }
Exemple #2
0
        public void AddMessage_ShouldAddMessagesToBuffer()
        {
            var message1 = _fixture.Create <Message>();
            var message2 = _fixture.Create <Message>();

            _sut.Add(message1);
            _sut.Add(message2);

            _sut.UnsentMessageCount.Should().Be(2);
            _sut.MessageBuffer.Should().Contain(message1);
            _sut.MessageBuffer.Should().Contain(message2);
        }
        public void SendMessage_ShouldBeLogged_BufferShouldBeEmpty(
            [Frozen] Mock <ILogger> logger,
            Message message1,
            Message message2,
            MessageSender sut)
        {
            message1.IsImportant = true;
            message2.IsImportant = false;

            sut.Add(message1);
            sut.Add(message2);

            sut.SendAll();

            logger.Verify(l => l.LogMessage(It.IsAny <string>()), Times.Once);
            logger.Verify(l => l.LogAsImportant(It.IsAny <string>()), Times.Once);

            sut.MessageBuffer.Should().BeEmpty();
        }
        public void SendLimited_ShouldSendExactNumberOfMesssages_ShouldRemoveExactNumberOfMessagesFromBuffer(
            [Frozen] Mock <ILogger> logger,
            Message message1,
            Message message2,
            Message message3,
            MessageSender sut)
        {
            message1.IsImportant = true;
            message2.IsImportant = false;

            sut.Add(message1);
            sut.Add(message2);
            sut.Add(message3);

            sut.SendLimited(2);

            logger.Verify(l => l.LogMessage(It.IsAny <string>()), Times.Once);
            logger.Verify(l => l.LogAsImportant(It.IsAny <string>()), Times.Once);
            sut.MessageBuffer.Count.Should().Be(1);
        }
Exemple #5
0
        public void AddMessage_ShouldAddMessagesToBuffer()
        {
            var unimportantMessage = new Message("*****@*****.**", "Awesome session bro!", false);
            var importantMessage   = new Message("*****@*****.**", "Kadiköy sensiz çekilmiyor :(", true);

            _sut.Add(unimportantMessage);
            _sut.Add(importantMessage);

            _sut.UnsentMessageCount.Should().Be(2);
            _sut.MessageBuffer.Should().Contain(unimportantMessage);
            _sut.MessageBuffer.Should().Contain(importantMessage);
        }