public static void AreEquivalent(decimal expected, JsonElement actual) { var expectedJson = expected.AsJsonElement(); if (!expectedJson.IsEquivalentTo(actual)) { Assert.Fail($"Expected: {expectedJson.ToJsonString()}\nActual: {actual.ToJsonString()}"); } }
public override JsonElement Apply(JsonElement data) { decimal result = 1; foreach (var item in _items) { var value = item.Apply(data); var number = value.Numberify(); if (number == null) { throw new JsonLogicException($"Cannot multiply {value.ValueKind}."); } result *= number.Value; } return(result.AsJsonElement()); }
public LiteralRule(decimal value) { _value = value.AsJsonElement(); }