Load() public method

Loads a template with the given name. Returns null if the template is not found
When a template is not found in the loader
public Load ( string name ) : string
name string The name of the template to load
return string
コード例 #1
0
ファイル: LoaderTest.cs プロジェクト: StubbleOrg/Stubble
 public void CompositeLoader_Should_Be_Able_To_Contain_StringLoader()
 {
     var loader = new CompositeLoader(new StringLoader());
     const string template = "{{foo}}";
     var loadedTemplate = loader.Load("{{foo}}");
     Assert.Equal(template, loadedTemplate);
 }
コード例 #2
0
ファイル: LoaderTest.cs プロジェクト: StubbleOrg/Stubble
 public void CompositeLoader_Should_Throw_Exception_If_No_Template_Found()
 {
     var loader = new CompositeLoader(new DictionaryLoader(new Dictionary<string, string>
     {
         { "test", "{{foo}}" }
     }));
     var ex = Assert.Throws<UnknownTemplateException>(() => loader.Load("test2"));
     Assert.Equal("No template was found with the name 'test2'", ex.Message);
 }
コード例 #3
0
ファイル: LoaderTest.cs プロジェクト: StubbleOrg/Stubble
 public void CompositeLoader_Should_Fall_Through()
 {
     var loader = new CompositeLoader(new DictionaryLoader(new Dictionary<string, string>
     {
         { "test", "{{foo}}" }
     }), new StringLoader());
     const string template = "{{foo}}";
     var loadedTemplate = loader.Load("{{foo}}");
     Assert.Equal(template, loadedTemplate);
 }