當前位置: 首頁>>代碼示例>>C#>>正文


C# Block.Render方法代碼示例

本文整理匯總了C#中Block.Render方法的典型用法代碼示例。如果您正苦於以下問題:C# Block.Render方法的具體用法?C# Block.Render怎麽用?C# Block.Render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Block的用法示例。


在下文中一共展示了Block.Render方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: It_supports_accessing_members_of_child_objects

        public void It_supports_accessing_members_of_child_objects()
        {
            var a = new Block("a.b", new LiteralText("c"));
            var writer = new StringWriter();
            var context = new RenderContext(null, new { a = new { b = new[] { 1, 2, 3 } } }, writer, null);

            a.Render(context);

            Assert.AreEqual("ccc", writer.GetStringBuilder().ToString());
        }
開發者ID:reicheltp,項目名稱:Nustache,代碼行數:10,代碼來源:Describe_Block.cs

示例2: It_renders_its_child_parts_once_for_each_item_if_name_evaluates_to_a_collection

        public void It_renders_its_child_parts_once_for_each_item_if_name_evaluates_to_a_collection()
        {
            var a = new Block("a", new LiteralText("b"));
            var writer = new StringWriter();
            var context = new RenderContext(null, new { a = new [] { 1, 2, 3 } }, writer, null);

            a.Render(context);

            Assert.AreEqual("bbb", writer.GetStringBuilder().ToString());
        }
開發者ID:reicheltp,項目名稱:Nustache,代碼行數:10,代碼來源:Describe_Block.cs

示例3: It_does_not_render_its_child_parts_if_name_evaluates_to_empty_string

        public void It_does_not_render_its_child_parts_if_name_evaluates_to_empty_string()
        {
            var a = new Block("a", new LiteralText("b"));
            var writer = new StringWriter();
            var context = new RenderContext(null, new { a = "" }, writer, null);

            a.Render(context);

            Assert.AreEqual("", writer.GetStringBuilder().ToString());
        }
開發者ID:reicheltp,項目名稱:Nustache,代碼行數:10,代碼來源:Describe_Block.cs

示例4: It_renders_its_child_parts_if_name_evaluates_to_true

        public void It_renders_its_child_parts_if_name_evaluates_to_true()
        {
            var a = new Block("a", new LiteralText("b"));
            var writer = new StringWriter();
            var context = new RenderContext(null, new { a = true }, writer, null, Options.Defaults());

            a.Render(context);

            Assert.AreEqual("b", writer.GetStringBuilder().ToString());
        }
開發者ID:lukemerrett,項目名稱:Nustache,代碼行數:10,代碼來源:Describe_Block.cs

示例5: It_does_not_treat_dictionaries_as_lists

        public void It_does_not_treat_dictionaries_as_lists()
        {
            var a = new Block("a", new LiteralText("x"));
            var writer = new StringWriter();
            var context = new RenderContext(
                null,
                new { a = new Dictionary<string, int> { { "b", 1 }, { "c", 2 }, { "d", 3 } } },
                writer,
                null);

            a.Render(context);

            Assert.AreEqual("x", writer.GetStringBuilder().ToString());
        }
開發者ID:reicheltp,項目名稱:Nustache,代碼行數:14,代碼來源:Describe_Block.cs

示例6: It_Nested_Fully_Qualified_Statements_Are_Evaluated

        public void It_Nested_Fully_Qualified_Statements_Are_Evaluated()
        {
            var a = new Block("a.b",
                        new Block("a.c", new LiteralText("I should render."), new EndSection("a.c")), 
                        new EndSection("a.b"));
            var writer = new StringWriter();
            var context = new RenderContext(
                null,
                new Dictionary<string, object> { { "a", new Dictionary<string, object> { { "b", 3 }, { "c", true } } } },
                writer,
                null);

            a.Render(context);

            Assert.AreEqual("I should render.", writer.GetStringBuilder().ToString());
        }
開發者ID:reicheltp,項目名稱:Nustache,代碼行數:16,代碼來源:Describe_Block.cs


注:本文中的Block.Render方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。