当前位置: 首页>>代码示例>>C#>>正文


C# ViewEngines.FakeModel类代码示例

本文整理汇总了C#中Nancy.Tests.Unit.ViewEngines.FakeModel的典型用法代码示例。如果您正苦于以下问题:C# FakeModel类的具体用法?C# FakeModel怎么用?C# FakeModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FakeModel类属于Nancy.Tests.Unit.ViewEngines命名空间,在下文中一共展示了FakeModel类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_render_block_when_ifnot_statement_returns_false

        public void Should_render_block_when_ifnot_statement_returns_false()
        {
            const string input = @"<html><head></head><body>@IfNot.HasUsers;<p>No users found!</p>@EndIf;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
            var model = new FakeModel("Nancy", new List<string>());

            var output = viewEngine.Render(input, model, this.fakeHost);

            Assert.Equal(@"<html><head></head><body><p>No users found!</p><ul></ul></body></html>", output);
        }
开发者ID:ninjaferret,项目名称:Nancy,代码行数:9,代码来源:SuperSimpleViewEngineTests.cs

示例2: Should_render_block_when_if_statement_returns_true

        public void Should_render_block_when_if_statement_returns_true()
        {
            const string input = @"<html><head></head><body>@If.HasUsers;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul>@EndIf;</body></html>";
            var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });

            var output = viewEngine.Render(input, model, this.fakeHost);

            Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
        }
开发者ID:ninjaferret,项目名称:Nancy,代码行数:9,代码来源:SuperSimpleViewEngineTests.cs

示例3: Should_allow_if_and_endif_without_semi_colon

        public void Should_allow_if_and_endif_without_semi_colon()
        {
            const string input = @"<html><head></head><body>@If.HasUsers<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul>@EndIf</body></html>";
            var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });

            var output = viewEngine.Render(input, model, this.fakeHost);

            Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
        }
开发者ID:ninjaferret,项目名称:Nancy,代码行数:9,代码来源:SuperSimpleViewEngineTests.cs

示例4: Should_allow_substitutions_to_work_with_standard_objects

        public void Should_allow_substitutions_to_work_with_standard_objects()
        {
            const string input = @"<html><head></head><body><ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
            var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });

            var output = viewEngine.Render(input, model, this.fakeHost);

            Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
        }
开发者ID:ninjaferret,项目名称:Nancy,代码行数:9,代码来源:SuperSimpleViewEngineTests.cs

示例5: Should_support_each_block_with_model_as_model_source

        public void Should_support_each_block_with_model_as_model_source()
        {
            const string input = @"<html><head></head><body><ul>@Each.Model.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
            var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });

            ((FakeViewEngineHost)this.fakeHost).Context = new FakeModel("NancyContext", new List<string>());

            var output = viewEngine.Render(input, model, this.fakeHost);

            Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
        }
开发者ID:kppullin,项目名称:Nancy,代码行数:11,代码来源:SuperSimpleViewEngineTests.cs

示例6: Should_allow_if_and_endif_and_model_model_source

        public void Should_allow_if_and_endif_and_model_model_source()
        {
            const string input = @"<html><head></head><body>@If.Model.HasUsers;Users [email protected]</body></html>";
            var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });

            ((FakeViewEngineHost)this.fakeHost).Context = new FakeModel("NancyContext", new List<string>());

            var output = viewEngine.Render(input, model, this.fakeHost);

            Assert.Equal(@"<html><head></head><body>Users found!</body></html>", output);
        }
开发者ID:kppullin,项目名称:Nancy,代码行数:11,代码来源:SuperSimpleViewEngineTests.cs

示例7: Should_stuffrender_block_when_ifnot_statement_returns_false

        public void Should_stuffrender_block_when_ifnot_statement_returns_false()
        {
            const string input = @"<html><head></head><body>@IfNot.Context.HasUsers;<p>No users found!</p>@EndIf;</body></html>";

            var model = new FakeModel("Nancy", new List<string>() { "Nancy " });

            ((FakeViewEngineHost)this.fakeHost).Context = new FakeModel("NancyContext", new List<string>());

            var output = viewEngine.Render(input, model, this.fakeHost);

            Assert.Equal(@"<html><head></head><body><p>No users found!</p></body></html>", output);
        }
开发者ID:kppullin,项目名称:Nancy,代码行数:12,代码来源:SuperSimpleViewEngineTests.cs

示例8: Should_not_conflict_when_if_and_ifNot_statements_combined_but_not_nested

        public void Should_not_conflict_when_if_and_ifNot_statements_combined_but_not_nested()
        {
            const string input = @"<html><head></head><body>@IfNot.HasUsers;<p>No users found!</p>@EndIf;@If.HasUsers;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul>@EndIf;</body></html>";
            var model = new FakeModel("Nancy", new List<string>());

            var output = viewEngine.Render(input, model);

            Assert.Equal(@"<html><head></head><body><p>No users found!</p></body></html>", output);
        }
开发者ID:hoffmanic,项目名称:Nancy,代码行数:9,代码来源:SuperSimpleViewEngineTests.cs

示例9: Should_allow_ifnot_and_endif_without_semi_colon

        public void Should_allow_ifnot_and_endif_without_semi_colon()
        {
            // Given
            const string input = @"<html><head></head><body>@IfNot.HasUsers<p>No users found!</p>@EndIf<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
            var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });

            // When
            var output = viewEngine.Render(input, model);

            // Then
            Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
        }
开发者ID:modulexcite,项目名称:TinyTemplates,代码行数:12,代码来源:SuperSimpleViewEngineTests.cs

示例10: Should_not_render_block_when_ifnot_statements_returns_true

        public void Should_not_render_block_when_ifnot_statements_returns_true()
        {
            // Given
            const string input = @"<html><head></head><body>@IfNot.HasUsers;<p>No users found!</p>@EndIf;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul></body></html>";
            var model = new FakeModel("Nancy", new List<string>() { "Bob", "Jim", "Bill" });

            // When
            var output = viewEngine.Render(input, model);

            // Then
            Assert.Equal(@"<html><head></head><body><ul><li>Hello Bob, Nancy says hello!</li><li>Hello Jim, Nancy says hello!</li><li>Hello Bill, Nancy says hello!</li></ul></body></html>", output);
        }
开发者ID:modulexcite,项目名称:TinyTemplates,代码行数:12,代码来源:SuperSimpleViewEngineTests.cs

示例11: Should_not_render_block_when_if_statement_returns_false

        public void Should_not_render_block_when_if_statement_returns_false()
        {
            // Given
            const string input = @"<html><head></head><body>@If.HasUsers;<ul>@Each.Users;<li>Hello @Current;, @Model.Name; says hello!</li>@EndEach;</ul>@EndIf;</body></html>";
            var model = new FakeModel("Nancy", new List<string>());

            // When
            var output = viewEngine.Render(input, model);

            // Then
            Assert.Equal(@"<html><head></head><body></body></html>", output);
        }
开发者ID:modulexcite,项目名称:TinyTemplates,代码行数:12,代码来源:SuperSimpleViewEngineTests.cs


注:本文中的Nancy.Tests.Unit.ViewEngines.FakeModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。