From b5e7aceaa6cd85f87c715c8c6f824bc76b485a86 Mon Sep 17 00:00:00 2001 From: Paul Grimshaw Date: Mon, 19 Sep 2016 12:32:46 +0100 Subject: [PATCH] Url from variable test added --- mustache-sharp.test/FormatCompilerTester.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mustache-sharp.test/FormatCompilerTester.cs b/mustache-sharp.test/FormatCompilerTester.cs index 72bcfee..3797b14 100644 --- a/mustache-sharp.test/FormatCompilerTester.cs +++ b/mustache-sharp.test/FormatCompilerTester.cs @@ -1476,6 +1476,17 @@ Odd Assert.AreEqual(expected, actual, "Value field didn't work"); } + [TestMethod] + public void TestCompile_UrlEncodeParam() { + FormatCompiler compiler = new FormatCompiler(); + const string format = @"{{#urlencode}}{{url}}{{/urlencode}}"; + Generator generator = compiler.Compile(format); + + string actual = generator.Render(new {url="https://google.com" }); + string expected = "https%3a%2f%2fgoogle.com"; + Assert.AreEqual(expected, actual, "Value field didn't work"); + } + [TestMethod] public void TestCompile_UrlDecode() { FormatCompiler compiler = new FormatCompiler();