public async Task DateKinds() { IMobileServiceTable <DateExample> table = GetClient().GetTable <DateExample>(); DateTime original = new DateTime(2009, 10, 21, 14, 22, 59, 860, DateTimeKind.Local); DateExample instance = new DateExample { Date = original }; Log("Start Kind: {0}", instance.Date.Kind); await table.InsertAsync(instance); Assert.AreEqual(DateTimeKind.Local, instance.Date.Kind); Assert.AreEqual(original, instance.Date); Log("Change to UTC"); instance.Date = new DateTime(2010, 5, 21, 0, 0, 0, 0, DateTimeKind.Utc); await table.UpdateAsync(instance); Assert.AreEqual(DateTimeKind.Local, instance.Date.Kind); Log("Change to Local"); instance.Date = new DateTime(2010, 5, 21, 0, 0, 0, 0, DateTimeKind.Local); await table.UpdateAsync(instance); Assert.AreEqual(DateTimeKind.Local, instance.Date.Kind); }
public async Task InsertAndQuery() { IMobileServiceTable<DateExample> table = GetClient().GetTable<DateExample>(); DateTime date = new DateTime(2009, 10, 21, 14, 22, 59, 860, DateTimeKind.Local); Log("Start: {0}", date); Log("Inserting instance"); DateExample instance = new DateExample { Date = date }; await table.InsertAsync(instance); Assert.AreEqual(date, instance.Date); Log("Querying for instance"); List<DateExample> items = await table.Where(i => i.Date == date).Where(i => i.Id >= instance.Id).ToListAsync(); Assert.AreEqual(1, items.Count); Assert.AreEqual(date, items[0].Date); Log("Finish: {0}", items[0].Date); }
public async Task InsertAndQuery() { IMobileServiceTable <DateExample> table = GetClient().GetTable <DateExample>(); DateTime date = new DateTime(2009, 10, 21, 14, 22, 59, 860, DateTimeKind.Local); Log("Start: {0}", date); Log("Inserting instance"); DateExample instance = new DateExample { Date = date }; await table.InsertAsync(instance); Assert.AreEqual(date, instance.Date); Log("Querying for instance"); List <DateExample> items = await table.Where(i => i.Date == date).Where(i => i.Id >= instance.Id).ToListAsync(); Assert.AreEqual(1, items.Count); Assert.AreEqual(date, items[0].Date); Log("Finish: {0}", items[0].Date); }
public async Task DateKinds() { IMobileServiceTable<DateExample> table = GetClient().GetTable<DateExample>(); DateTime original = new DateTime(2009, 10, 21, 14, 22, 59, 860, DateTimeKind.Local); DateExample instance = new DateExample { Date = original }; Log("Start Kind: {0}", instance.Date.Kind); await table.InsertAsync(instance); Assert.AreEqual(DateTimeKind.Local, instance.Date.Kind); Assert.AreEqual(original, instance.Date); Log("Change to UTC"); instance.Date = new DateTime(2010, 5, 21, 0, 0, 0, 0, DateTimeKind.Utc); await table.UpdateAsync(instance); Assert.AreEqual(DateTimeKind.Local, instance.Date.Kind); Log("Change to Local"); instance.Date = new DateTime(2010, 5, 21, 0, 0, 0, 0, DateTimeKind.Local); await table.UpdateAsync(instance); Assert.AreEqual(DateTimeKind.Local, instance.Date.Kind); }