public static List<EntityWithNullableTimeUuid> GetDefaultObjectList()
 {
     List<EntityWithNullableTimeUuid> defaultTimeUuidObjList = new List<EntityWithNullableTimeUuid>();
     for (int i = 1; i <= DefaultRecordCount; i++)
     {
         EntityWithNullableTimeUuid entity = new EntityWithNullableTimeUuid();
         entity.NullableTimeUuidType = TimeUuid.NewId(DateTimeOffset.Parse("2014-3-" + i));
         entity.GuidType = Guid.NewGuid();
         defaultTimeUuidObjList.Add(entity);
     }
     return defaultTimeUuidObjList;
 }
 public static bool AssertListContains(List<EntityWithNullableTimeUuid> expectedEntities, EntityWithNullableTimeUuid actualEntity)
 {
     foreach (var expectedEntity in expectedEntities)
     {
         try
         {
             AssertEquals(expectedEntity, actualEntity);
             return true;
         }
         catch (AssertionException) { }
     }
     return false;
 }
 public static void AssertEquals(EntityWithNullableTimeUuid expectedEntity, EntityWithNullableTimeUuid actualEntity)
 {
     Assert.AreEqual(expectedEntity.GuidType, actualEntity.GuidType);
     Assert.AreEqual(expectedEntity.StringType, actualEntity.StringType);
     Assert.AreEqual(expectedEntity.NullableTimeUuidType, actualEntity.NullableTimeUuidType);
 }
Example #4
0
        public void MaxTimeUuid_GreaterThanOrEqualTo_NullableTimeUuidComparison()
        {
            EntityWithNullableTimeUuid.SetupEntity(_tableEntityWithNullableTimeUuid, _expectedNullableTimeUuidObjectList);

            EntityWithNullableTimeUuid defaultEntity = new EntityWithNullableTimeUuid();
            var whereQuery = _tableEntityWithNullableTimeUuid.Where(s => s.NullableTimeUuidType >= CqlFunction.MaxTimeUuid(_dateBefore) && s.StringType == defaultEntity.StringType);
            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.MaxTimeUuid(_dateAfter));
            List<EntityWithNullableTimeUuid> objectsReturned2 = whereQuery.ExecuteAsync().Result.ToList();
            Assert.AreEqual(0, objectsReturned2.Count);
        }