public async Task FormatString(object input, object[] args, string culture, string expected) { var cultureInfo = String.IsNullOrEmpty(culture) ? CultureInfo.InvariantCulture : CultureInfo.CreateSpecificCulture(culture) ; var context = new TemplateContext(new TemplateOptions { CultureInfo = cultureInfo }); var arguments = new FilterArguments(args.Select(x => FluidValue.Create(x, context.Options)).ToArray()); var result = await MiscFilters.FormatString(FluidValue.Create(input, context.Options), arguments, context); Assert.Equal(expected, result.ToStringValue()); }
public void FormatString(object input, object[] args, string culture, string expected) { var cultureInfo = String.IsNullOrEmpty(culture) ? CultureInfo.InvariantCulture : CultureInfo.CreateSpecificCulture(culture) ; var arguments = new FilterArguments(args.Select(FluidValue.Create).ToArray()); var context = new TemplateContext { CultureInfo = cultureInfo }; var result = MiscFilters.FormatString(FluidValue.Create(input), arguments, context); Assert.Equal(expected, result.ToStringValue()); }