public void DividedByReturnsSameTypeAsDivisor(double value, object divisor, double expected) { var input = NumberValue.Create(value); var arguments = new FilterArguments(NumberValue.Create(Convert.ToDouble(divisor), divisor is int)); var context = new TemplateContext(); var result = NumberFilters.DividedBy(input, arguments, context); Assert.Equal(expected, result.ToNumberValue()); }
public void DividedBy() { var input = new NumberValue(6); var arguments = new FilterArguments(3); var context = new TemplateContext(); var result = NumberFilters.DividedBy(input, arguments, context); Assert.Equal(2, result.ToNumberValue()); }
public void DividedByReturnsSameTypeAsDivisor(decimal value, string divisor, decimal expected) { // https://shopify.github.io/liquid/filters/divided_by/ var input = NumberValue.Create(value); var arguments = new FilterArguments(NumberValue.Create(divisor)); var context = new TemplateContext(); var result = NumberFilters.DividedBy(input, arguments, context); Assert.Equal(expected, result.Result.ToNumberValue()); }