public void BuildRecipientWithDisplaySubstitutionStep_WithPersonalizedSubstitution(string address, string token, string value) { var rec = new MessageRecipient().ToAddress(address); var toStep = new MessageBuilder.BuildRecipientsStep.BuildToStep.BuildRecipientWithDisplaySubstitutionStep( new MailerMessage().To(rec), rec); if (token == null) { toStep.Invoking(c => c.WithPersonalizedSubstitution(null, value)).ShouldThrow <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); } }
public void BuildRecipientWithDisplaySubstitutionStep_And() { var rec = new MessageRecipient().ToAddress("*****@*****.**"); var toStep = new MessageBuilder.BuildRecipientsStep.BuildToStep.BuildRecipientWithDisplaySubstitutionStep( new MailerMessage().To(rec), rec); toStep.And .Should() .NotBeNull() .And.BeOfType <MessageBuilder.BuildContentStep>(); }