public void FetchAllMessages_ValidParams_ReturnsExpectedMessages()
        {
            // arrange
            _emailService = new EmailService(_stubEmailWatcherOptions, _fakePopClientFactory, _messageTranslator);

            // act
            List<EmailWatcherMessage> messages = _emailService.FetchAllMessages();

            // assert
            Assert.IsNotNull(messages);
            Assert.AreEqual(FakePopClientAdapter.StubMessageCount, messages.Count);
            Assert.AreEqual(FakePopClientAdapter.StubSubject, messages.FirstOrDefault().Subject);
            Assert.AreEqual(FakePopClientAdapter.StubBody + "\r\n", messages.FirstOrDefault().Body);
        }
        public void FetchAllMessages_ValidParams_InvokesPopClientAdapter()
        {
            // arrange
            _emailService = new EmailService(_stubEmailWatcherOptions, _fakePopClientFactory, _messageTranslator);

            // act
            _emailService.FetchAllMessages();

            // assert
            Assert.IsTrue(FakePopClientAdapter.HasBeenInvoked);
        }
        public void DeleteMessage_ValidMessageId_InvokesFakePopClientFactory()
        {
            // arrange
            _emailService = new EmailService(_stubEmailWatcherOptions, _fakePopClientFactory, _messageTranslator);

            // act
            _emailService.DeleteMessage("1");

            // assert
            Assert.IsTrue(_fakePopClientFactory.HasBeenInvoked);
        }
        public void FetchAllMessages_PopClientAdapterThrowsException_ExceptionIsSwallowed()
        {
            // arrange
            _emailService = new EmailService(_stubEmailWatcherOptions, new FakePopClientFactoryThatReturnsAPopClientAdapterThatAlwaysThrowsExceptions(), _messageTranslator);

            // act

            // assert
        }
        public void DeleteMessage_NullMessageId_ThrowsException()
        {
            // arrange
            _emailService = new EmailService(_stubEmailWatcherOptions, _fakePopClientFactory, _messageTranslator);

            // act
            _emailService.DeleteMessage(null);

            // assert
        }