Ejemplo n.º 1
0
        private static void ParseTemplate(MessageTemplate messageTemplate, int languageId, dynamic model, out bool subjectSuccess, out bool bodySuccess)
        {
            var subject = messageTemplate.GetLocalized(mt => mt.Subject, languageId);
            var body    = messageTemplate.GetLocalized(mt => mt.Body, languageId);

            RazorTemplateParser.ParseSafe(messageTemplate.Id, subject, model, out subjectSuccess);

            RazorTemplateParser.ParseSafe(messageTemplate.Id, body, model, out bodySuccess);
        }
Ejemplo n.º 2
0
        public void Test()
        {
            var parser = new RazorTemplateParser();
            //var mail = parser.Parse(
            //    new MailTemplate {
            //        Content = File.ReadAllText("razor.xml")
            //    },
            //    new Dictionary<string, object> {
            //        { "Test", "Test" },
            //        { "Subject", "Test" }
            //    }
            //);

            //Assert.False(mail.IsBodyHtml);
            //Assert.AreEqual("Test", mail.Subject);
            //Assert.True(mail.Body.Contains("POOF"));
            //Assert.True(mail.Body.Contains("WORKS"));
        }