public void MinTimeUuid_Linq_Test()
        {
            string query = null;

            object[] parameters = null;
            var      session    = GetSession((q, v) =>
            {
                query      = q;
                parameters = v;
            });
            var table     = GetTable <AllTypesEntity>(session, new Map <AllTypesEntity>().TableName("tbl2"));
            var timestamp = DateTimeOffset.Parse("1/1/2010");

            table.Where(t => t.UuidValue < CqlFunction.MinTimeUuid(timestamp)).Execute();
            Assert.AreEqual("SELECT BooleanValue, DateTimeValue, DecimalValue, DoubleValue, Int64Value, IntValue, StringValue, UuidValue FROM tbl2 WHERE UuidValue < mintimeuuid(?)", query);
            Assert.AreEqual(timestamp, parameters[0]);
        }
示例#2
0
        public void MinTimeUuid_GreaterThanOrEqualTo_TimeUuidComparison()
        {
            EntityWithTimeUuid.SetupEntity(_tableEntityWithTimeUuid, _expectedTimeUuidObjectList);

            var whereQuery = _tableEntityWithTimeUuid.Where(s => s.TimeUuidType >= CqlFunction.MinTimeUuid(_dateBefore));
            List <EntityWithTimeUuid> objectsReturned1 = whereQuery.ExecuteAsync().Result.ToList();

            Assert.AreEqual(_expectedTimeUuidObjectList.Count, objectsReturned1.Count);

            foreach (var actualObj in objectsReturned1)
            {
                EntityWithTimeUuid.AssertListContains(_expectedTimeUuidObjectList, actualObj);
            }

            whereQuery = _tableEntityWithTimeUuid.Where(s => s.TimeUuidType >= CqlFunction.MinTimeUuid(_dateAfter));
            List <EntityWithTimeUuid> objectsReturned2 = whereQuery.ExecuteAsync().Result.ToList();

            Assert.AreEqual(0, objectsReturned2.Count);
        }
示例#3
0
        public void MinTimeUuid_GreaterThan_NullableTimeUuidComparison()
        {
            EntityWithNullableTimeUuid.SetupEntity(_tableEntityWithNullableTimeUuid, _expectedNullableTimeUuidObjectList);

            var whereQuery = _tableEntityWithNullableTimeUuid.Where(s => s.NullableTimeUuidType > CqlFunction.MinTimeUuid(_dateBefore));
            List <EntityWithNullableTimeUuid> objectsReturned1 = whereQuery.ExecuteAsync().Result.ToList();

            Assert.AreEqual(_expectedTimeUuidObjectList.Count, objectsReturned1.Count);

            foreach (var actualObj in objectsReturned1)
            {
                EntityWithNullableTimeUuid.AssertListContains(_expectedNullableTimeUuidObjectList, actualObj);
            }

            //var taskSelect = _movieTable.Where(m => m.Title == expectedMovie.Title && m.MovieMaker == expectedMovie.MovieMaker).ExecuteAsync();
            whereQuery = _tableEntityWithNullableTimeUuid.Where(s => s.NullableTimeUuidType > CqlFunction.MinTimeUuid(_dateAfter));
            List <EntityWithNullableTimeUuid> objectsReturned2 = whereQuery.ExecuteAsync().Result.ToList();

            Assert.AreEqual(0, objectsReturned2.Count);
        }
示例#4
0
        public void MinTimeUuid_LessThanOrEqualTo_NullableTimeUuidComparison()
        {
            EntityWithNullableTimeUuid.SetupEntity(_tableEntityWithNullableTimeUuid, _expectedNullableTimeUuidObjectList);

            var    whereQuery      = _tableEntityWithNullableTimeUuid.Where(s => s.NullableTimeUuidType <= CqlFunction.MinTimeUuid(_dateAfter));
            string whereQueryToStr = whereQuery.ToString();

            Console.WriteLine(whereQueryToStr);
            List <EntityWithNullableTimeUuid> objectsReturned1 = whereQuery.ExecuteAsync().Result.ToList();

            Assert.AreEqual(_expectedTimeUuidObjectList.Count, objectsReturned1.Count);

            foreach (var actualObj in objectsReturned1)
            {
                EntityWithNullableTimeUuid.AssertListContains(_expectedNullableTimeUuidObjectList, actualObj);
            }

            whereQuery      = _tableEntityWithNullableTimeUuid.Where(s => s.NullableTimeUuidType <= CqlFunction.MinTimeUuid(_dateBefore));
            whereQueryToStr = whereQuery.ToString();
            Console.WriteLine(whereQueryToStr);
            List <EntityWithNullableTimeUuid> objectsReturned2 = whereQuery.ExecuteAsync().Result.ToList();

            Assert.AreEqual(0, objectsReturned2.Count);
        }