示例#1
0
        public static void AreEquivalent(decimal expected, JsonElement actual)
        {
            var expectedJson = expected.AsJsonElement();

            if (!expectedJson.IsEquivalentTo(actual))
            {
                Assert.Fail($"Expected: {expectedJson.ToJsonString()}\nActual: {actual.ToJsonString()}");
            }
        }
示例#2
0
        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());
        }
示例#3
0
 public LiteralRule(decimal value)
 {
     _value = value.AsJsonElement();
 }