Пример #1
0
        public void EmailTemplate_HtmlCode_01()
        {
            // Arrange
            var template = new HtmlEmailTemplate();

            template.Load("{{html for(int i = 0; i < 3; i++) { }}{{#i}} {{ } }}");

            // Act
            var result = template.Run(out _);

            // Assert
            Assert.Equal("0 1 2 ", result);
        }
Пример #2
0
        public void EmailTemplate_UrlEncode_01()
        {
            // Arrange
            var template = new HtmlEmailTemplate();

            template.Load("Hello <a href=\"http://www.localhost.com/{{#url \"Sample&Url\" }}\">Meziantou</a>!");

            // Act
            var result = template.Run(out _);

            // Assert
            Assert.Equal("Hello <a href=\"http://www.localhost.com/Sample%26Url\">Meziantou</a>!", result);
        }
Пример #3
0
        public void EmailTemplate_HtmlAttributeEncode_01()
        {
            // Arrange
            var template = new HtmlEmailTemplate();

            template.Load("Hello <a href=\"{{#attr \"Sample&Sample\"}}\">Meziantou</a>!");

            // Act
            var result = template.Run(out _);

            // Assert
            Assert.Equal("Hello <a href=\"Sample&amp;Sample\">Meziantou</a>!", result);
        }
Пример #4
0
        public void EmailTemplate_HtmlEncode_01()
        {
            // Arrange
            var template = new HtmlEmailTemplate();

            template.Load("Hello {{#html \"<Meziantou>\" }}!");

            // Act
            var result = template.Run(out _);

            // Assert
            Assert.Equal("Hello &lt;Meziantou&gt;!", result);
        }