public async Task ServerUnreachableOnFirstSend()
        {
            using var smtpServer   = SimpleSmtpServer.Start(smtpConfiguration.Port);
            using var notification = new SmtpGreetingsNotification(smtpConfiguration);

            smtpServer.Stop();

            var ex = await Assert.ThrowsAsync <SmtpException>(() =>
                                                              notification.SendBirthday(new[]
            {
                new EmailInfo("foo", "*****@*****.**"),
            }));

            Assert.Equal(SmtpStatusCode.GeneralFailure, ex.StatusCode);
        }
        public async Task SendBirthday()
        {
            using var smtpServer   = SimpleSmtpServer.Start(smtpConfiguration.Port);
            using var notification = new SmtpGreetingsNotification(smtpConfiguration);

            await notification.SendBirthday(new[]
            {
                new EmailInfo("foo", "*****@*****.**"),
            });

            ReceivedMail.FromAll(smtpServer)
            .Should()
            .BeEquivalentTo(new ReceivedMail(smtpConfiguration.Sender,
                                             "*****@*****.**",
                                             "Happy birthday!",
                                             "Happy birthday, dear foo!"));
        }
        public async Task ServerUnreachableDuringSend()
        {
            using var smtpServer   = SimpleSmtpServer.Start(smtpConfiguration.Port);
            using var notification = new SmtpGreetingsNotification(smtpConfiguration,
                                                                   new StopServerAfterOneSend(smtpServer));

            var ex = await Assert.ThrowsAsync <SmtpException>(() =>
                                                              notification.SendBirthday(new[]
            {
                new EmailInfo("foo", "*****@*****.**"),
                new EmailInfo("bar", "*****@*****.**"),
            }));

            Assert.Equal(SmtpStatusCode.GeneralFailure, ex.StatusCode);

            ReceivedMail.FromAll(smtpServer)
            .Should()
            .BeEquivalentTo(new ReceivedMail(smtpConfiguration.Sender,
                                             "*****@*****.**",
                                             "Happy birthday!",
                                             "Happy birthday, dear foo!"));
        }