Esempio n. 1
0
        public void Test_WithPersonalization2_ShouldReplacePersonalizationCollection()
        {
            var instance = new MailerSendEmailParameters();

            instance.WithTo("*****@*****.**");
            instance.WithTo("*****@*****.**");
            instance.WithPersonalization(new MailerSendEmailPersonalization("*****@*****.**", new { p1 = "1" }));
            instance.WithPersonalization("*****@*****.**", new { p1 = "2" });
            instance.Personalizations.Should().NotBeEmpty();
            instance.Personalizations.Should().HaveCount(2);

            var item = instance.Personalizations.Last();

            item.Email.Should().Be("*****@*****.**");
            item.Data.Should().NotBeNull();
            item.Data.Should().Be(new { p1 = "2" });
        }
Esempio n. 2
0
        public void Test_WithPersonalization2_ShouldRequireEmailInRecipientCollection()
        {
            var    instance = new MailerSendEmailParameters();
            Action action   = () => instance.WithPersonalization("*****@*****.**", new { p1 = "1" });

            action.Should()
            .Throw <InvalidOperationException>()
            .WithMessage("The email must be in the list of recipients (to)");
        }