Exemple #1
0
        public void TestContactInformationAuctionSaleArtWork()
        {
            // arrange
            ContactInformation contactInformation = new ContactInformationAuction()
            {
                FirstName = "Homero",
                LastName = "Simpson",
                Author = "Picasso",
                Dimensions = "3x3"
            };

            IMailBuilder<ContactInformation> mailBuilder = new ContactInformationMailBuilder();

            // act
            MailMessage message = mailBuilder
                                    .WithFrom("*****@*****.**")
                                    .WithTo("*****@*****.**")
                                    .WithSubject("Hola")
                                    .WithEntity(contactInformation).BuildMessage();

            // assert
            Assert.That(message.From.Address, Is.EqualTo("*****@*****.**"));
            Assert.That(message.To, Has.All.Matches<MailAddress>(x => x.Address == "*****@*****.**"));
            Assert.That(message.Subject, Is.EqualTo("Hola"));
            Assert.That(message.Body, Is.StringContaining("Nombre: Homero"));
            Assert.That(message.Body, Is.StringContaining("Apellido: Simpson"));
            Assert.That(message.Body, Is.StringContaining("Autor: Picasso"));
            Assert.That(message.Body, Is.StringContaining("Dimensiones: 3x3"));
        }
Exemple #2
0
        public void TestContactInformationSubsidiary()
        {
            // arrange
            ContactInformationSubsidiary contactInformation = new ContactInformationSubsidiary()
            {
                FirstName = "Homero",
                LastName = "Simpson",
                Subsidiary = "Retiro"
            };

            IMailBuilder<ContactInformation> mailBuilder = new ContactInformationMailBuilder();

            // act
            MailMessage message = mailBuilder
                                    .WithFrom("*****@*****.**")
                                    .WithTo("*****@*****.**")
                                    .WithSubject("Hola")
                                    .WithEntity(contactInformation).BuildMessage();

            // assert
            Assert.That(message.From.Address, Is.EqualTo("*****@*****.**"));
            Assert.That(message.To, Has.All.Matches<MailAddress>(x => x.Address == "*****@*****.**"));
            Assert.That(message.Subject, Is.EqualTo("Hola"));
            Assert.That(message.Body, Is.StringContaining("Nombre: Homero"));
            Assert.That(message.Body, Is.StringContaining("Apellido: Simpson"));
            Assert.That(message.Body, Is.StringContaining("Sucursal: Retiro"));
        }