Example #1
0
        public void RangeNotContainedByRange(NpgsqlRange <int> range)
        {
            using var context = CreateContext();
            var _ = context.RangeTestEntities
                    .Where(x => !range.ContainedBy(x.Range))
                    .ToArray();

            AssertContainsSql(@"WHERE NOT (@__range_0 <@ r.""Range"")");
        }
        public void RangeNotContainedByRange(NpgsqlRange <int> range)
        {
            using (RangeContext context = Fixture.CreateContext())
            {
                RangeTestEntity[] _ =
                    context.RangeTestEntities
                    .Where(x => !range.ContainedBy(x.Range))
                    .ToArray();

                AssertContainsSql("WHERE NOT ((@__range_0 <@ x.\"Range\") = TRUE)");
            }
        }
        public void RangeContainedByRange(NpgsqlRange <int> range)
        {
            using (var context = Fixture.CreateContext())
            {
                var _ =
                    context.RangeTestEntities
                    .Where(x => range.ContainedBy(x.Range))
                    .ToArray();

                AssertContainsSql(@"@__range_0 <@ r.""Range""");
            }
        }
Example #4
0
    public void ContainedBy()
    {
        using var context = CreateContext();
        var range  = new NpgsqlRange <int>(8, 13);
        var result = context.RangeTestEntities.Single(x => range.ContainedBy(x.IntRange));

        Assert.Equal(2, result.Id);

        AssertSql(
            @"@__range_0='[8,13]' (DbType = Object)

SELECT r.""Id"", r.""DateOnlyDateRange"", r.""DateTimeDateRange"", r.""DecimalRange"", r.""IntRange"", r.""LongRange"", r.""UserDefinedRange"", r.""UserDefinedRangeWithSchema""
FROM ""RangeTestEntities"" AS r
WHERE @__range_0 <@ r.""IntRange""
LIMIT 2");
    }