public void TruncateWords(string input, int size, string output) { var source = new StringValue(input); var arguments = new FilterArguments() .Add(new NumberValue(size)); var context = new TemplateContext(); var result = StringFilters.TruncateWords(source, arguments, context); Assert.Equal(output, result.ToStringValue()); }
public void TruncateWords() { var input = new StringValue("This is a nice story with a bad end."); var arguments = new FilterArguments().Add(new NumberValue(5)).Add(new StringValue("...")); var context = new TemplateContext(); var result = StringFilters.TruncateWords(input, arguments, context); Assert.Equal("This is a nice story...", result.ToStringValue()); }