Beispiel #1
0
        public void ConvertFromTest()
        {
            // Arrange
            SetupCalls();
            var emailTemplateConverter =
                new EmailTemplateConverter(fakeDynamicContentExtensions);

            //Act
            emailTemplateConverter.ConvertFrom(fakeDynamicContentItem);

            //Assert
            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened(5, Times.Exactly);
            A.CallTo(() => fakeDynamicContentExtensions.GetContentWithoutHtmlTags(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened(1, Times.Exactly);
        }
        public EmailTemplate ConvertFrom(DynamicContent content)
        {
            var emailTemplate = new EmailTemplate
            {
                TemplateName = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.TemplateName)),
                From         = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.From)),
                To           = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.To)),
                Subject      = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.Subject)),
                Body         = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.Body)),
                BodyNoHtml   = dynamicContentExtensions.GetContentWithoutHtmlTags(content, nameof(EmailTemplate.Body))
            };

            return(emailTemplate);
        }