Exemple #1
0
        private IRouteValue Generate(IComparable comparable, Column column, string @operator)
        {
            string columnName = column.Name;
            string tableName  = column.TableName;

            switch (@operator)
            {
            case EQUAL:
                return(new ListRouteValue(columnName, tableName, new List <IComparable>()
                {
                    comparable
                }));

            case GREATER_THAN:
                return(new RangeRouteValue(columnName, tableName, Range.GreaterThan(comparable)));

            case LESS_THAN:
                return(new RangeRouteValue(columnName, tableName, Range.LessThan(comparable)));

            case AT_MOST:
                return(new RangeRouteValue(columnName, tableName, Range.AtMost(comparable)));

            case AT_LEAST:
                return(new RangeRouteValue(columnName, tableName, Range.AtLeast(comparable)));

            default:
                return(null);
            }
        }
Exemple #2
0
        public void ToStringHandlesAtMostRange()
        {
            var range = Range <int> .AtMost(10);

            var expected = "(-∞..10]";
            var actual   = range.ToString();

            Assert.Equal(expected, actual);
        }
        public void ReturnsExpectedInfiniteRangePrecedesResult(
            BoundType rangeType,
            int otherLower, int otherUpper, BoundType otherType,
            bool expectedResult, string description)
        {
            var range = rangeType == BoundType.CLOSED ? Range <int> .AtMost(10) : Range <int> .LessThan(10);

            var other  = Helper.Create(otherLower, otherUpper, otherType);
            var output = $"{range} {description} {other}";

            _output.WriteLine(output);
            Assert.Equal(expectedResult, range.Precedes(other));
        }