public void BetweenValueAtHighEndReturnsTrue()
        {
            var rule = new LessThanEqualRule(1, 3, 3);

            JsonAssert.IsTrue(rule.Apply());
        }
        public void BetweenValueInRangeReturnsTrue()
        {
            var rule = new LessThanEqualRule(1, 2, 3);

            JsonAssert.IsTrue(rule.Apply());
        }
        public void BetweenValueUnderLowEndReturnsFalse()
        {
            var rule = new LessThanEqualRule(1, 0, 3);

            JsonAssert.IsFalse(rule.Apply());
        }
        public void LessThanEqualObjectThrowsError()
        {
            var rule = new LessThanEqualRule(JsonDocument.Parse("{}").RootElement, 2);

            Assert.Throws <JsonLogicException>(() => rule.Apply());
        }
        public void LessThanEqualNullThrowsError()
        {
            var rule = new LessThanEqualRule(LiteralRule.Null, 2);

            Assert.Throws <JsonLogicException>(() => rule.Apply());
        }
        public void LessThanEqualBooleanThrowsError()
        {
            var rule = new LessThanEqualRule(false, 2);

            JsonAssert.IsTrue(rule.Apply());
        }
        public void LessThanEqualArrayThrowsError()
        {
            var rule = new LessThanEqualRule(new JsonElement[] {}.AsJsonElement(), 2);

            Assert.Throws <JsonLogicException>(() => rule.Apply());
        }
        public void LessThanEqualStringThrowsError()
        {
            var rule = new LessThanEqualRule("foo", 2);

            Assert.Throws <JsonLogicException>(() => rule.Apply());
        }
        public void LessThanEqualTwoNumbersReturnsFalse()
        {
            var rule = new LessThanEqualRule(3, 2);

            JsonAssert.IsFalse(rule.Apply());
        }
Пример #10
0
        public void EqualTwoNumbersReturnsTrue()
        {
            var rule = new LessThanEqualRule(2, 2);

            JsonAssert.IsTrue(rule.Apply());
        }
Пример #11
0
        public void BetweenHighEndNotNumberThrowsError()
        {
            var rule = new LessThanEqualRule(1, 2, false);

            Assert.Throws <JsonLogicException>(() => rule.Apply());
        }
Пример #12
0
        public void BetweenValueOverHighEndReturnsFalse()
        {
            var rule = new LessThanEqualRule(1, 4, 3);

            JsonAssert.IsFalse(rule.Apply());
        }