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); }
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; }
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; }
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; }
public IntegerMatch(int value, IntegerOperationType operation) { _value = value; _operation = operation; }