public override void OneTimeSetUp() { base.OneTimeSetUp(); _session = Session; _session.CreateKeyspace(_uniqueKsName); _session.ChangeKeyspace(_uniqueKsName); // Create necessary tables MappingConfiguration config1 = new MappingConfiguration(); config1.MapperFactory.PocoDataFactory.AddDefinitionDefault(typeof(EntityWithTimeUuid), () => LinqAttributeBasedTypeDefinition.DetermineAttributes(typeof(EntityWithTimeUuid))); _tableEntityWithTimeUuid = new Table <EntityWithTimeUuid>(_session, config1); _tableEntityWithTimeUuid.Create(); MappingConfiguration config2 = new MappingConfiguration(); config2.MapperFactory.PocoDataFactory.AddDefinitionDefault(typeof(EntityWithNullableTimeUuid), () => LinqAttributeBasedTypeDefinition.DetermineAttributes(typeof(EntityWithNullableTimeUuid))); _tableEntityWithNullableTimeUuid = new Table <EntityWithNullableTimeUuid>(_session, config2); _tableEntityWithNullableTimeUuid.Create(); _expectedTimeUuidObjectList = EntityWithTimeUuid.GetDefaultObjectList(); _expectedNullableTimeUuidObjectList = EntityWithNullableTimeUuid.GetDefaultObjectList(); _dateBefore = DateTimeOffset.Parse("2014-2-1"); _dateAfter = DateTimeOffset.Parse("2014-4-1"); }
public void MaxTimeUuid_LessThanOrEqualTo_NullableTimeUuidComparison() { EntityWithNullableTimeUuid.SetupEntity(_tableEntityWithNullableTimeUuid, _expectedNullableTimeUuidObjectList); var whereQuery = _tableEntityWithNullableTimeUuid.Where(s => s.NullableTimeUuidType <= CqlFunction.MaxTimeUuid(_dateAfter)); 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(_dateBefore)); List <EntityWithNullableTimeUuid> objectsReturned2 = whereQuery.ExecuteAsync().Result.ToList(); Assert.AreEqual(0, objectsReturned2.Count); }
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); }