Esempio n. 1
0
        public void BuiltToWithDisplayStep_WithPersonalizedSubstitution(string address, string token, string value)
        {
            var rec    = new MessageRecipient().ToAddress(address);
            var toStep =
                new MessageBuilder.BuildRecipientsStep.BuildToStep.BuiltToWithDisplayStep(new MailerMessage().To(rec),
                                                                                          rec);

            if (token == null)
            {
                toStep.Invoking(c => c.WithPersonalizedSubstitution(null, value)).Should().Throw <ArgumentNullException>();
            }
            else
            {
                var stepBuilder = toStep.WithPersonalizedSubstitution(token, value);

                stepBuilder
                .Should()
                .NotBeNull()
                .And
                .BeOfType <MessageBuilder.BuildRecipientsStep.BuildToStep.BuildRecipientWithDisplaySubstitutionStep
                           >()
                .Which.As <IBuilderContext>()
                .Message.Recipients
                .Should()
                .NotBeEmpty()
                .And.AllBeAssignableTo <MessageRecipient>()
                .And.ContainSingle(r => r.EmailAddress == address)
                .Which.PersonalizedSubstitutions.Should()
                .ContainKey(token)
                .WhichValue.Should()
                .Be(value);
            }
        }
Esempio n. 2
0
        public void BuiltToWithDisplayStep_And()
        {
            var rec    = new MessageRecipient().ToAddress("*****@*****.**");
            var toStep =
                new MessageBuilder.BuildRecipientsStep.BuildToStep.BuiltToWithDisplayStep(new MailerMessage().To(rec),
                                                                                          rec);

            toStep.And
            .Should()
            .NotBeNull()
            .And.BeOfType <MessageBuilder.BuildContentStep>();
        }