private void Add(TemplateTag tag) { try { tags.Add(tag.Type, tag); } catch (Exception e) when(e is ArgumentException || e is ArgumentNullException || e is NotSupportedException) { throw new ArgumentException($"There was a problem when inserting tag for {tag.Type}"); } }
public void TestFill(string templateString, string content, string expected) { var tag = new TemplateTag { Template = templateString }; var filler = new TemplateFiller(); var result = filler.Fill(tag, content); Assert.Equal(expected, result); }
private TemplateTag GetTagWriterFor(string fileName) { try { var template = new TemplateTag(); TagType type = GetTagTypeForString(fileName); template.Type = type; return(template); } catch (ArgumentException ex) { string value = $"There was an exception when converting template file names into template types. {fileName} did not convert cleanly"; Console.WriteLine(value); throw (new ArgumentException(value, ex)); } }
public override string ApplyTemplate(TemplateTag tpl) { return tpl.Apply(this.Path); }
public string Fill(TemplateTag tag, string content) { return(tag.Template.Replace("{{}}", content)); }
public void AddTag(TemplateTag templateTag) { _templateTags[templateTag.Tag] = templateTag; }
public override string ApplyTemplate(TemplateTag tpl) { return(tpl.Apply(this.Path)); }