public void MaxTimeUuid_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("tbl100")); table.Where(t => t.UuidValue <= CqlFunction.MaxTimeUuid(DateTimeOffset.Parse("1/1/2005"))).Execute(); Assert.AreEqual("SELECT BooleanValue, DateTimeValue, DecimalValue, DoubleValue, Int64Value, IntValue, StringValue, UuidValue FROM tbl100 WHERE UuidValue <= maxtimeuuid(?)", query); Assert.AreEqual(DateTimeOffset.Parse("1/1/2005"), parameters[0]); table.Where(t => CqlFunction.MaxTimeUuid(DateTimeOffset.Parse("1/1/2005")) > t.UuidValue).Execute(); Assert.AreEqual("SELECT BooleanValue, DateTimeValue, DecimalValue, DoubleValue, Int64Value, IntValue, StringValue, UuidValue FROM tbl100 WHERE maxtimeuuid(?) > UuidValue", query); }
public void MaxTimeUuid_GreaterThanOrEqualTo_TimeUuidComparison() { EntityWithTimeUuid.SetupEntity(_tableEntityWithTimeUuid, _expectedTimeUuidObjectList); var whereQuery = _tableEntityWithTimeUuid.Where(s => s.TimeUuidType >= CqlFunction.MaxTimeUuid(_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.MaxTimeUuid(_dateAfter)); List <EntityWithTimeUuid> objectsReturned2 = whereQuery.ExecuteAsync().Result.ToList(); Assert.AreEqual(0, objectsReturned2.Count); }
public void MaxTimeUuid_LessThanOrEqualTo_NullableTimeUuidComparison() { EntityWithNullableTimeUuid.SetupEntity(_tableEntityWithNullableTimeUuid, _expectedNullableTimeUuidObjectList); var whereQuery = _tableEntityWithNullableTimeUuid.Where(s => s.NullableTimeUuidType <= CqlFunction.MaxTimeUuid(_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.MaxTimeUuid(_dateBefore)); whereQueryToStr = whereQuery.ToString(); Console.WriteLine(whereQueryToStr); List <EntityWithNullableTimeUuid> objectsReturned2 = whereQuery.ExecuteAsync().Result.ToList(); Assert.AreEqual(0, objectsReturned2.Count); }