예제 #1
0
        public void IntegerMatch_Evaluation_Cases_Tests(int value, IntegerOperationType operation, string input, bool expectedResult)
        {
            var context = new RewriteContext {
                HttpContext = new DefaultHttpContext()
            };
            var integerMatch = new IntegerMatch(value, operation);
            var matchResult  = integerMatch.Evaluate(input, context);

            Assert.Equal(expectedResult, matchResult.Success);
        }
예제 #2
0
        public IntegerMatch(string value, IntegerOperationType operation)
        {
            int compValue;

            if (!int.TryParse(value, NumberStyles.None, CultureInfo.InvariantCulture, out compValue))
            {
                throw new FormatException("Syntax error for integers in comparison.");
            }
            _value     = compValue;
            _operation = operation;
        }
예제 #3
0
        public IntegerMatch(string value, IntegerOperationType operation)
        {
            int compValue;

            if (!int.TryParse(value, NumberStyles.None, CultureInfo.InvariantCulture, out compValue))
            {
                throw new FormatException(Resources.Error_IntegerMatch_FormatExceptionMessage);
            }
            _value     = compValue;
            _operation = operation;
        }
예제 #4
0
    public IntegerMatch(string value, IntegerOperationType operation)
    {
        int compValue;

        if (!int.TryParse(value, NumberStyles.None, CultureInfo.InvariantCulture, out compValue))
        {
            throw new FormatException(Resources.Error_IntegerMatch_FormatExceptionMessage);
        }
        _value = compValue;

        if (operation < IntegerOperationType.Equal || operation > IntegerOperationType.NotEqual)
        {
            throw new ArgumentOutOfRangeException(nameof(operation));
        }

        _operation = operation;
    }
예제 #5
0
 public IntegerMatch(int value, IntegerOperationType operation)
 {
     _value     = value;
     _operation = operation;
 }