コード例 #1
0
ファイル: 10_LiquidViewEngine.cs プロジェクト: rhwy/humid
        templates_use_an_abstraction()
        {
            var server = new Dictionary <string, string> {
                ["Site:PhysicalFullPath"] = new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName
            };

            var headers = new Dictionary <string, string[]> {
                ["accept"] = new [] { "text/html" }
            };
            var testContext = Defaults.Context.With(
                requestHeaders: headers,
                path: "/hello/world/42",
                type: GET,
                server: server);

            var sampleObject = new { name = "world" };

            ITemplateEngine engine = liquidEngineForTest;

            Check.ThatCode(() => {
                string renderTemplate          = engine.RenderTemplate(testContext, "simpleLiquid");
                string renderTemplateWithModel = engine.RenderTemplate(testContext, "simpleliquid", sampleObject);
                Check.That(renderTemplateWithModel).IsEqualTo("hello world");
            }).DoesNotThrow();
        }