當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。