GetSender() public method

public GetSender ( MailMessage mailMessage ) : System.Net.Mail.MailAddress
mailMessage MailMessage
return System.Net.Mail.MailAddress
コード例 #1
0
        public void Should_ReturnSenderMailAddressFromBody_WnehCalledGetSenderFromForwardedMail(string body, string mailAddress)
        {
            //arrange
            var mailMessage = new MailMessage
            {
                Body = body,
            };
            var mailMessageParser = new MailMessageParserThunderbird();

            //act
            var result = mailMessageParser.GetSender(mailMessage);

            //assert
            result.Address.Should().Be(mailAddress);
        }
コード例 #2
0
        public void Should_ThrowException_WhenCalledGetSenderWithNoEmailAddressInBody()
        {
            //arrange
            var mailMessage = new MailMessage
                                  {
                                      Body = "No email addresses there"
                                  };
            var mailMessageParser = new MailMessageParserThunderbird();

            //act
            Action action = () => mailMessageParser.GetSender(mailMessage);

            //assert
            action
                .ShouldThrow<ApplicationException>()
                .WithMessage("Forwarded message has illegal format");
        }