public void CanCompileAndRunLater() { var service = new HandlebarsService(); service.Compile("template-name", "Hello {{name}}"); Assert.Equal("Hello Matt", service.Run("template-name", new { name = "Matt" })); }
public void CanCompileAndRunLater() { var service = new HandlebarsService(); service.Compile("template-name", "Hello {{name}}"); Assert.Equal("Hello Matt", service.Run("template-name", new { name = "Matt" })); }
public void SupportsRootLookupThroughPartial() { var service = new HandlebarsService(); string template = "Your name is {{>person_name}}"; var model = new { world = "World", person = new { forename = "Matthew", surname = "Abbott" } }; string partial = "{{@root.person.forename}} {{@root.person.surname}}"; service.RegisterPartial("person_name", partial); service.Compile("hello-world", template); string result = service.Run("hello-world", model); string expected = "Your name is Matthew Abbott"; Assert.Equal(expected, result); }
public void SupportsRootLookupThroughPartial() { var service = new HandlebarsService(); string template = "Your name is {{>person_name}}"; var model = new { world = "World", person = new { forename = "Matthew", surname = "Abbott" } }; string partial = "{{@root.person.forename}} {{@root.person.surname}}"; service.RegisterPartial("person_name", partial); service.Compile("hello-world", template); string result = service.Run("hello-world", model); string expected = "Your name is Matthew Abbott"; Assert.Equal(expected, result); }