Пример #1
0
        public void GreaterOperatorThrows()
        {
            Operator op = new GreaterOperator().Greater;

            MeVariable[] arr = { new MeString("test"), new MeNumber(10) };
            Assert.IsFalse(op.CanExecute(arr));
            TestUtils.CustomExceptionTest(() => op.Execute(arr), typeof(MeContextException));
        }
Пример #2
0
        public void GreaterOperatorCanCompare()
        {
            Operator op = new GreaterOperator().Greater;

            MeVariable[] arr = { new MeNumber(10), new MeNumber(20) };
            Assert.IsTrue(op.CanExecute(arr));
            bool result = op.Execute(arr).Get <bool>();

            Assert.AreEqual(false, result);
        }
Пример #3
0
        public void ShouldBeGreaterThanValue([Range(0, 5)] int value)
        {
            // Given
            var filter = new GreaterOperator(EntityType, IntField, value);
            var entity = new FilterTestEntity {
                IntField = 3
            };

            // When
            var isSatisfy = filter.IsSatisfiedBy(entity);

            // Then
            Assert.AreEqual(entity.IntField > value, isSatisfy);
        }