コード例 #1
0
        public void ProcessEmails_RaisesEmailReceivedEventWithExpectedValues()
        {
            // arrange
            EmailWatcherMessage receivedMessage = null;
            _emailWatcher = new EmailWatcher.Public.EmailWatcher(_options, _fakeEmailWatcherOptionsValidator, _fakeEmailService);
            _emailWatcher.EmailReceivedEvent += (sender, args) =>
            {
                receivedMessage = args.Message;
            };

            // act
            _emailWatcher.ProcessEmails();

            // assert
            Assert.IsNotNull(receivedMessage);
            Assert.AreEqual(FakeEmailService.StubMessageId, receivedMessage.Id);
            Assert.AreEqual(FakeEmailService.StubMessageBody, receivedMessage.Body);
            Assert.AreEqual(FakeEmailService.StubMessageSubject, receivedMessage.Subject);
        }
コード例 #2
0
        public void ProcessEmails_FetchesMessages()
        {
            // arrange
            _emailWatcher = new EmailWatcher.Public.EmailWatcher(_options, _fakeEmailWatcherOptionsValidator, _fakeEmailService);

            // act
            _emailWatcher.ProcessEmails();

            // assert
            Assert.IsTrue(_fakeEmailService.HasFetchedMessages);
        }