Exemple #1
0
        public async Task InsertAndQueryOffset()
        {
            IMobileServiceTable <DateOffsetExample> table = GetClient().GetTable <DateOffsetExample>();

            DateTimeOffset date = new DateTimeOffset(
                new DateTime(2009, 10, 21, 14, 22, 59, 860, DateTimeKind.Utc).ToLocalTime());

            Log("Start: {0}", date);

            Log("Inserting instance");
            DateOffsetExample instance = new DateOffsetExample {
                Date = date
            };
            await table.InsertAsync(instance);

            Assert.AreEqual(date, instance.Date);

            Log("Querying for instance");
            List <DateOffsetExample> 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 InsertAndQueryOffset()
        {
            IMobileServiceTable<DateOffsetExample> table = GetClient().GetTable<DateOffsetExample>();

            DateTimeOffset date = new DateTimeOffset(
                new DateTime(2009, 10, 21, 14, 22, 59, 860, DateTimeKind.Utc).ToLocalTime());
            Log("Start: {0}", date);

            Log("Inserting instance");
            DateOffsetExample instance = new DateOffsetExample { Date = date };
            await table.InsertAsync(instance);
            Assert.AreEqual(date, instance.Date);

            Log("Querying for instance");
            List<DateOffsetExample> 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);
        }