Example #1
0
        public void TestNotContains()
        {
            var r = new NpgsqlRange <int>(1, 2);

            Assert.False(NpgsqlRangeExtensions.Includes(r, 0));
            Assert.False(NpgsqlRangeExtensions.Includes(r, 3));
        }
Example #2
0
        public void TestContainsEqual()
        {
            var r = new NpgsqlRange <int>(0, 1);

            Assert.True(NpgsqlRangeExtensions.Includes(r, 1));
            Assert.True(NpgsqlRangeExtensions.Includes(r, 0));
        }
Example #3
0
 public static Modified ClassifyModification(IEnumerable <IMutableEntity> entity, NpgsqlRange <DateTime> range)
 {
     if (!entity.Any())
     {
         return(Modified.New);
     }
     else if (!NpgsqlRangeExtensions.Includes(range, entity.First().UpdateDate))
     {
         return(Modified.Updated);
     }
     else
     {
         return(Modified.Equal);
     }
 }
Example #4
0
        public void TestInfity()
        {
            var ru = new NpgsqlRange <int>(0, false, false, 0, false, true);

            Assert.True(NpgsqlRangeExtensions.Includes(ru, 1));
            Assert.False(NpgsqlRangeExtensions.Includes(ru, -1));
            var rl = new NpgsqlRange <int>(0, false, true, 0, false, false);

            Assert.False(NpgsqlRangeExtensions.Includes(rl, 1));
            Assert.True(NpgsqlRangeExtensions.Includes(rl, -1));
            var ul = new NpgsqlRange <int>(0, false, true, 0, false, true);

            Assert.True(NpgsqlRangeExtensions.Includes(ul, 1));
            Assert.True(NpgsqlRangeExtensions.Includes(ul, -1));
        }