Ejemplo n.º 1
0
 public async Task <ObservableCollection <PhotoRecord> > ReadPhotoRecordsAsync(string userId)
 {
     return(await recordsTable.WithParameters(new Dictionary <string, string>
     {
         { "userId", userId }
     }).ToCollectionAsync <PhotoRecord>());
 }
        public async Task WithParametersAsyncGeneric()
        {
            var userDefinedParameters = new Dictionary <string, string>()
            {
                { "state", "WY" }
            };

            TestHttpHandler hijack = new TestHttpHandler();

            hijack.SetResponseContent("[{\"id\":12,\"String\":\"Hey\"}]");
            IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);

            IMobileServiceTable <StringType> table = service.GetTable <StringType>();
            List <StringType> people = await table.WithParameters(userDefinedParameters).ToListAsync();

            Assert.Contains(hijack.Request.RequestUri.ToString(), "StringType");
            Assert.Contains(hijack.Request.RequestUri.Query, "state=WY");

            Assert.AreEqual(1, people.Count);
            Assert.AreEqual(12, people[0].Id);
            Assert.AreEqual("Hey", people[0].String);
        }
 public IMobileServiceTableQuery <T> WithParameters(IDictionary <string, string> parameters)
 {
     return(_table.WithParameters(parameters));
 }