public async Task ReadAsync_WithRelativeUri_Generic()
        {
            var data = new[]
            {
                new 
                {
                    ServiceUri = "http://www.test.com", 
                    QueryUri = "/about?$filter=a eq b&$orderby=c", 
                    RequestUri = "http://www.test.com/about?$filter=a eq b&$orderby=c"
                },
                new 
                {
                    ServiceUri = "http://www.test.com/", 
                    QueryUri = "/about?$filter=a eq b&$orderby=c", 
                    RequestUri = "http://www.test.com/about?$filter=a eq b&$orderby=c"
                }
            };

            foreach (var item in data)
            {
                var hijack = new TestHttpHandler();
                hijack.SetResponseContent("[{\"col1\":\"Hey\"}]");
                IMobileServiceClient service = new MobileServiceClient(item.ServiceUri, "secret...", hijack);

                IMobileServiceTable<ToDo> table = service.GetTable<ToDo>();

                await table.ReadAsync<ToDo>(item.QueryUri);

                Assert.AreEqual("TT", hijack.Request.Headers.GetValues("X-ZUMO-FEATURES").First());
                Assert.AreEqual(item.RequestUri, hijack.Request.RequestUri.ToString());
            }
        }
        public void Construction()
        {
            string appUrl = "http://www.test.com/";
            string appKey = "secret...";

            MobileServiceClient service = new MobileServiceClient(new Uri(appUrl), appKey);
            Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
            Assert.AreEqual(appKey, service.ApplicationKey);

            service = new MobileServiceClient(appUrl, appKey);
            Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
            Assert.AreEqual(appKey, service.ApplicationKey);

            service = new MobileServiceClient(new Uri(appUrl));
            Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
            Assert.AreEqual(null, service.ApplicationKey);

            service = new MobileServiceClient(appUrl);
            Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
            Assert.AreEqual(null, service.ApplicationKey);

            Uri none = null;
            Throws<ArgumentNullException>(() => new MobileServiceClient(none));
            Throws<FormatException>(() => new MobileServiceClient("not a valid uri!!!@#!@#"));
        }
예제 #3
0
 public void Start()
 {
     setCredentials();
     client = new MobileServiceClient(appUrl, appKey);
     table = client.GetTable<Highscore>("Highscores");
     QueryItemsByScore();
 }
 public async Task RegisterAsync_ErrorEmptyChannelUri()
 {
     var mobileClient = new MobileServiceClient(DefaultServiceUri);
     var exception = await AssertEx.Throws<ArgumentNullException>(
    () => mobileClient.GetPush().RegisterAsync(""));
     Assert.AreEqual(exception.Message, "Value cannot be null.\r\nParameter name: channelUri");
 }
        /// <summary>
        /// Utility method that can be used to execute a test.  It will capture any exceptions throw
        /// during the execution of the test and return a message with details of the exception thrown.
        /// </summary>
        /// <param name="testName">The name of the test being executed.
        /// </param>
        /// <param name="test">A test to execute.
        /// </param>
        /// <returns>
        /// Either the result of the test if the test passed, or a message with the exception
        /// that was thrown.
        /// </returns>
        public static async Task<string> ExecuteTest(string testName, Func<Task<string>> test)
        {
            string resultText = null;
            bool didPass = false;

            if (client == null)
            {
                string appUrl = null;
                string appKey = null;
                App.Harness.Settings.Custom.TryGetValue("MobileServiceRuntimeUrl", out appUrl);
                App.Harness.Settings.Custom.TryGetValue("MobileServiceRuntimeKey", out appKey);

                client = new MobileServiceClient(appUrl, appKey);
            }

            try
            {
                resultText = await test();
                didPass = true;
            }
            catch (Exception exception)
            {
                resultText = string.Format("ExceptionType: {0} Message: {1} StackTrace: {2}",
                                               exception.GetType().ToString(),
                                               exception.Message,
                                               exception.StackTrace);
            }

            return string.Format("Test '{0}' {1}.\n{2}",
                                 testName,
                                 didPass ? "PASSED" : "FAILED",
                                 resultText);
        }
예제 #6
0
 public void Setup()
 {
     if (_item == null)
         _item = new Item {Text = "Just some random text"};
     if (_client == null)
         _client = new MobileServiceClient(string.Empty /* Your endpoint */, string.Empty /* Your Api key */);
 }
예제 #7
0
        protected void Statistika_Click(object sender, EventArgs e)
        {
            MobileServiceClient client = new MobileServiceClient();

            if (OS.Checked == true)
            {
                int []mas = new int[4];
                mas = client.statOS();
                Info.Text = "Кол-во пользователей Android: " + mas[0];
                Info1.Text = "Кол-во пользователей iOS: " + mas[1];
                Info2.Text = "Кол-во пользователей WindowsPhone: " + mas[2];
                Info3.Text = "Кол-во пользователей других ОС: " + mas[3];
            }
            if (Read.Checked == true)
            {
                Info.Text = "Для чтения телефон использует " + client.statRead()+ " людей";
                Info1.Text = "";
                Info2.Text = "";
                Info3.Text = "";
            }
            if (Price.Checked == true)
            {
                Info.Text = "Средняя цена, которую люди готовы заплатить за новый мобильный телефон: "+client.statPrice()+"$";
                Info1.Text = "";
                Info2.Text = "";
                Info3.Text = "";
            }
        }
        public async Task ReadAsyncWithStringIdTypeAndStringIdResponseContent()
        {
            string[] testIdData = IdTestData.ValidStringIds.Concat(
                                  IdTestData.EmptyStringIds).Concat(
                                  IdTestData.InvalidStringIds).ToArray();

            foreach (string testId in testIdData)
            {
                TestHttpHandler hijack = new TestHttpHandler();

                // Make the testId JSON safe
                string jsonTestId = testId.Replace("\\", "\\\\").Replace("\"", "\\\"");

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

                IMobileServiceTable<StringIdType> table = service.GetTable<StringIdType>();

                IEnumerable<StringIdType> results = await table.ReadAsync();
                StringIdType[] items = results.ToArray();

                Assert.AreEqual(1, items.Count());
                Assert.AreEqual(testId, items[0].Id);
                Assert.AreEqual("Hey", items[0].String);
            }
        }
 public async Task RegisterAsync_ErrorEmptyChannelUri()
 {
     var mobileClient = new MobileServiceClient(DefaultServiceUri);
     string emptyRegistrationId = string.Empty;
     var exception = await AssertEx.Throws<ArgumentNullException>(() => mobileClient.GetPush().RegisterAsync(emptyRegistrationId));
     Assert.AreEqual(exception.ParamName, "registrationId");
 }
예제 #10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            questionnaire quest = new questionnaire();
            quest.sex = Sex.Text;
            quest.age = Convert.ToInt32(Age.Text);
            quest.profession = Profession.Text;
            quest.income = Convert.ToInt32(Income.Text);
            quest.mobile_existence = 0;
            if (MobileExistence.Text.Equals("&nbspда"))
                quest.mobile_existence = 1;
            quest.brand = Brand.Text;
            quest.price = Convert.ToInt32(Price.Text);
            quest.OS = OS.Text;
            quest.furniture = 0;
            if (Furniture.Text.Equals("&nbspда"))
                quest.furniture = 1;
            quest.read = 0;
            if (Read.Text.Equals("&nbspда"))
                quest.read = 1;
            

            MobileServiceClient client = new MobileServiceClient();
            client.addQuestionnaire(quest);


        }
        public async Task ListRegistrations_Native()
        {
            // Ensure Uri and method are correct for request and specify body to return for registrations list with only 1 native registration
            var expectedUri = this.GetExpectedListUri();
            var hijack = CreateTestHttpHandler(expectedUri, HttpMethod.Get, this.pushTestUtility.GetListNativeRegistrationResponse());

            MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri, null, hijack);
            var pushHttpClient = new PushHttpClient(mobileClient);

            var registrations = await pushHttpClient.ListRegistrationsAsync(DefaultChannelUri);

            Assert.AreEqual(registrations.Count(), 1, "Expected 1 registration.");

            var firstRegistration = registrations.First();
            var nativeReg = this.pushUtility.GetNewNativeRegistration();
            Assert.AreEqual(nativeReg.GetType(), firstRegistration.GetType(), "The type of the registration returned from ListRegistrationsAsync is not of the correct type.");

            Assert.AreEqual(firstRegistration.RegistrationId, DefaultRegistrationId, "The registrationId returned from ListRegistrationsAsync is not correct.");

            var tags = firstRegistration.Tags.ToList();
            Assert.AreEqual(tags[0], "fooWns", "tag[0] on the registration is not correct.");
            Assert.AreEqual(tags[1], "barWns", "tag[1] on the registration is not correct.");
            Assert.AreEqual(tags[2], "4de2605e-fd09-4875-a897-c8c4c0a51682", "tag[2] on the registration is not correct.");

            Assert.AreEqual(firstRegistration.PushHandle, DefaultChannelUri, "The DeviceId on the registration is not correct.");
        }
 public async Task RegisterAsync_ErrorEmptyChannelUri()
 {
     var mobileClient = new MobileServiceClient(DefaultServiceUri);
     NSData deviceToken = null;
     var exception = await AssertEx.Throws<ArgumentNullException>(() => mobileClient.GetPush().RegisterAsync(deviceToken));
     Assert.AreEqual(exception.ParamName, "deviceToken");
 }
        public void InstallationId()
        {
            MobileServiceClient service = new MobileServiceClient("http://test.com");

            //string settings = ApplicationData.Current.LocalSettings.Values["MobileServices.Installation.config"] as string;
            //string id = (string)JToken.Parse(settings)["applicationInstallationId"];
            //Assert.IsNotNull(id);
        }
 public async Task RegisterAsync_ErrorHttp()
 {
     MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri);
     var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, InstallationsPath, mobileClient.GetPush().InstallationId);
     var hijack = TestHttpDelegatingHandler.CreateTestHttpHandler(expectedUri, HttpMethod.Put, null, HttpStatusCode.BadRequest);
     mobileClient = new MobileServiceClient(DefaultServiceUri, hijack);
     var exception = await AssertEx.Throws<MobileServiceInvalidOperationException>(() => mobileClient.GetPush().RegisterAsync(this.registrationId));
     Assert.AreEqual(exception.Response.StatusCode, HttpStatusCode.BadRequest);
 }
        public MobileServiceSyncContext(MobileServiceClient client)
        {
            if (client == null)
            {
                throw new ArgumentNullException("client");
            }

            this.client = client;
        }
 /// <summary>
 /// Get a client pointed at the test server without request logging.
 /// </summary>
 /// <returns>The test client.</returns>
 public MobileServiceClient GetClient()
 {
     if (staticClient == null)
     {
         string runtimeUrl = this.GetTestSetting("MobileServiceRuntimeUrl");
         staticClient = new MobileServiceClient(runtimeUrl, new LoggingHttpHandler(this));
     }
     return staticClient;
 }
        public async Task ReadAsync_Throws_IfAbsoluteUriHostNameDoesNotMatch()
        {
            IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp, new TestHttpHandler());
            IMobileServiceTable<ToDo> table = service.GetTable<ToDo>();

            var ex = await AssertEx.Throws<ArgumentException>(async () => await table.ReadAsync<ToDo>("http://www.contoso.com/about?$filter=a eq b&$orderby=c"));

            Assert.AreEqual(ex.Message, "The query uri must be on the same host as the Mobile Service.");
        }
        public async Task RefreshAsync_Succeeds_WhenIdIsNull()
        {
            IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp);
            await service.SyncContext.InitializeAsync(new MobileServiceLocalStoreMock(), new MobileServiceSyncHandler());

            IMobileServiceSyncTable<StringIdType> table = service.GetSyncTable<StringIdType>();

            var item = new StringIdType() { String = "what?" };
            await table.RefreshAsync(item);
        }
        public async Task RefreshAsync_Succeeds_WhenIdIsNull()
        {
            IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...");
            await service.SyncContext.InitializeAsync(new MobileServiceLocalStoreMock(), new MobileServiceSyncHandler());

            IMobileServiceSyncTable<StringIdType> table = service.GetSyncTable<StringIdType>();

            var item = new StringIdType() { String = "what?" };
            await table.RefreshAsync(item);
        }
        public async Task RefreshAsync_ThrowsInvalidOperationException_WhenIdItemDoesNotExist()
        {
            IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...");
            await service.SyncContext.InitializeAsync(new MobileServiceLocalStoreMock(), new MobileServiceSyncHandler());

            IMobileServiceSyncTable<StringIdType> table = service.GetSyncTable<StringIdType>();

            var item = new StringIdType() { Id = "abc" };
            InvalidOperationException ex = await ThrowsAsync<InvalidOperationException>(() => table.RefreshAsync(item));
            Assert.AreEqual(ex.Message, "Item not found in local store.");
        }
        public async Task DeleteInstallationAsync()
        {
            MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri);
            var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, InstallationsPath, mobileClient.InstallationId);
            var hijack = TestHttpDelegatingHandler.CreateTestHttpHandler(expectedUri, HttpMethod.Delete, null, HttpStatusCode.NoContent);

            mobileClient = new MobileServiceClient(DefaultServiceUri, hijack);
            var pushHttpClient = new PushHttpClient(mobileClient);

            await pushHttpClient.DeleteInstallationAsync();
        }
        public async Task RegisterAsync_ChannelUri()
        {
            MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri);

            var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, InstallationsPath, mobileClient.GetPush().InstallationId);
            string installationRegistration = JsonConvert.SerializeObject(this.pushTestUtility.GetInstallation(mobileClient.GetPush().InstallationId, false));
            var hijack = TestHttpDelegatingHandler.CreateTestHttpHandler(expectedUri, HttpMethod.Put, null, HttpStatusCode.OK, expectedRequestContent: installationRegistration);

            mobileClient = new MobileServiceClient(DefaultServiceUri, hijack);
            await mobileClient.GetPush().RegisterAsync(DefaultChannelUri);
        }
        public MobileServiceSyncTable(string tableName, MobileServiceTableKind Kind, MobileServiceClient client)
        {
            Debug.Assert(tableName != null);
            Debug.Assert(client != null);

            this.MobileServiceClient = client;
            this.TableName = tableName;
            this.Kind = Kind;
            this.syncContext = (MobileServiceSyncContext)client.SyncContext;
            this.SupportedOptions = MobileServiceRemoteTableOptions.All;
        }
예제 #24
0
 public void Start()
 {
     setCredentials();
     namePanel.SetActive(false);
     scoreText.transform.localPosition = new Vector2(0, 140);
     pgms = gameObject.AddComponent<PregameMenuSingle>();
     client = new MobileServiceClient(appUrl, appKey);
     table = client.GetTable<Highscore>("Highscores");
     score = pgms.getScore();
     playerText.text = "Your score: " + score;
     QueryItemsByScore();
 }
        public void DoesNotRewireSingleWiredDelegatingHandler()
        {
            string appUrl = MobileAppUriValidator.DummyMobileApp;

            TestHttpHandler innerHandler = new TestHttpHandler();
            DelegatingHandler wiredHandler = new TestHttpHandler();
            wiredHandler.InnerHandler = innerHandler;

            IMobileServiceClient service = new MobileServiceClient(appUrl, handlers: wiredHandler);

            Assert.AreEqual(wiredHandler.InnerHandler, innerHandler, "The prewired handler passed in should not have been rewired");
        }
        public async Task RegisterAsync_WithTemplates_TemplateBodyJSON()
        {
            MobileServiceClient mobileClient = new MobileServiceClient(DefaultServiceUri);

            var expectedUri = string.Format("{0}{1}/{2}", DefaultServiceUri, InstallationsPath, mobileClient.GetPush().InstallationId);
            JObject templates = this.pushTestUtility.GetTemplates(true);
            string installationRegistration = JsonConvert.SerializeObject(this.pushTestUtility.GetInstallation(mobileClient.GetPush().InstallationId, true));
            var hijack = TestHttpDelegatingHandler.CreateTestHttpHandler(expectedUri, HttpMethod.Put, null, HttpStatusCode.OK, expectedRequestContent: installationRegistration);

            mobileClient = new MobileServiceClient(DefaultServiceUri, hijack);
            await mobileClient.GetPush().RegisterAsync(this.originalNSData, templates);
        }
예제 #27
0
 public ZumoRequest(MobileServiceClient client, string uri, Method httpMethod)
     : base(uri, httpMethod)
 {
     this.AddHeader("X-ZUMO-APPLICATION", client.AppKey);
     this.AddHeader("Content-Type", "application/json; charset=UTF-8");
     this.RequestFormat = DataFormat.Json;
     if (client.User != null && !string.IsNullOrEmpty(client.User.authenticationToken))
     {
         this.AddHeader("X-ZUMO-AUTH", client.User.authenticationToken);
         Debug.Log("Auth UserId:" + client.User.user.userId);
     }
 }
        public async Task DateOffsetUri()
        {
            TestHttpHandler hijack = new TestHttpHandler();
            IMobileServiceClient client = new MobileServiceClient("http://www.test.com", null, hijack);
            IMobileServiceTable<DateOffsetExample> table = client.GetTable<DateOffsetExample>();

            hijack.Response.StatusCode = HttpStatusCode.OK;
            hijack.SetResponseContent("[]");

            DateTimeOffset date = new DateTimeOffset(2009, 11, 21, 14, 22, 59, 860, TimeSpan.FromHours(-8));
            await table.Where(b => b.Date == date).ToEnumerableAsync();
            Assert.EndsWith(hijack.Request.RequestUri.ToString(), "$filter=(DateOffsetExampleDate eq datetimeoffset'2009-11-21T14:22:59.8600000-08:00')");
        }
        public async Task InsertAsync_GeneratesId_WhenNull()
        {
            IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp);
            await service.SyncContext.InitializeAsync(new MobileServiceLocalStoreMock(), new MobileServiceSyncHandler());

            var item = new JObject();
            JObject inserted = await service.GetSyncTable("someTable").InsertAsync(item);
            Assert.IsNotNull(inserted.Value<string>("id"), "Expected id member not found.");

            item = new JObject() { { "id", null } };
            inserted = await service.GetSyncTable("someTable").InsertAsync(item);
            Assert.IsNotNull(inserted.Value<string>("id"), "Expected id member not found.");
        }
        public async Task DateOffsetUri()
        {
            TestHttpHandler hijack = new TestHttpHandler();
            IMobileServiceClient client = new MobileServiceClient("http://www.test.com", null, hijack);
            IMobileServiceTable<DateOffsetExample> table = client.GetTable<DateOffsetExample>();

            hijack.Response = new HttpResponseMessage(HttpStatusCode.OK);
            hijack.SetResponseContent("[]");

            var date = DateTimeOffset.Parse("2009-11-21T06:22:59.8600000-08:00");
            await table.Where(b => b.Date == date).ToEnumerableAsync();
            Assert.EndsWith(hijack.Request.RequestUri.ToString(), "$filter=(DateOffsetExampleDate eq datetimeoffset'2009-11-21T06:22:59.8600000-08:00')");
        }
예제 #31
0
 private AzureManager()
 {
     this.client            = new MobileServiceClient("http://yumwhatsthis.azurewebsites.net");
     this.foodLocationTable = this.client.GetTable <FoodLocationModel>();
 }
 public ScheduleManager()
 {
     this.client        = new MobileServiceClient(Constants.ApplicationURL);
     this.Scheduletable = client.GetTable <Schedule>();
 }
 private AccountService()
 {
     this.client        = MobileService.MobileServiceClient;
     this.accountsTable = client.GetTable <AccountEntity>();
 }
예제 #34
0
 private AzureManager()
 {
     this.client             = new MobileServiceClient("http://employeeap.azurewebsites.net");
     this.employeeModelTable = this.client.GetTable <EmployeeModel>();
 }
 protected AzureServiceBase()
 {
     Client = new MobileServiceClient(FunctionAppUrl);
 }
예제 #36
0
 public async Task LogoutAsync(MobileServiceClient client)
 {
     await client.LogoutAsync();
 }
예제 #37
0
        public ASIGNADO()
        {
            MobileServiceClient            client;
            IMobileServiceTable <TodoItem> tabla;

            client = new MobileServiceClient(Constants.ApplicationURL);
            tabla  = client.GetTable <TodoItem>();
            Dictionary <string, Color> res = new Dictionary <string, Color>
            {
                { "*****@*****.**", Color.Green },
                { "*****@*****.**", Color.Red }
            };

            Picker responsable = new Picker
            {
                Title           = "RESPONSABLE",
                VerticalOptions = LayoutOptions.Center
            };

            foreach (string respon in res.Keys)
            {
                responsable.Items.Add(respon);
            }
            Button leer = new Button()
            {
                Text = "leer Tabla",
                HorizontalOptions = LayoutOptions.Center,
            };

            leer.HorizontalOptions = LayoutOptions.Center;
            leer.TextColor         = Color.Black;
            leer.BackgroundColor   = Color.White;
            Label mensaje1 = new Label();

            mensaje1.IsVisible = false;
            Label    mensaje   = new Label();
            Label    mensaje01 = new Label();
            Label    mensaje2  = new Label();
            ListView lista     = new ListView();
            ListView lista1    = new ListView();
            ListView lista2    = new ListView();

            leer.Clicked += async(sender, args) =>
            {
                if (responsable.SelectedIndex == -1)
                {
                    await DisplayAlert("No a seleccionado ningun asignado por favor verifique", "", "Ok");
                }
                else
                {
                    IEnumerable <TodoItem> items = await tabla.Where(TodoItem => TodoItem.Responsable == responsable.Items[responsable.SelectedIndex]).ToListAsync();

                    string[] arreglo  = new string[items.Count()];
                    string[] arreglo1 = new string[items.Count()];
                    string[] arreglo2 = new string[items.Count()];
                    int      i        = 0;
                    foreach (var x in items)
                    {
                        mensaje.Text   = "TAREA";
                        arreglo[i]     = x.Tarea;
                        mensaje01.Text = "FECHA INICIO";
                        arreglo1[i]    = x.Update;
                        mensaje2.Text  = "FECHA FINAL";
                        arreglo2[i]    = x.Fecha_Fin;
                        i++;
                    }
                    lista.ItemsSource         = arreglo;
                    lista1.ItemsSource        = arreglo1;
                    lista2.ItemsSource        = arreglo2;
                    responsable.SelectedIndex = -1;
                }
            };

            Content = new StackLayout
            {
                Children =
                {
                    responsable,
                    leer,
                    mensaje,
                    lista,
                    mensaje01,
                    lista1,

                    mensaje2,
                    lista2,
                }
            };
        }
예제 #38
0
 public ConflictHandler(MobileServiceClient client, ConflictResolutionPolicy conflictResolutionPolicy)
 {
     this._client = client;
     _conflictResolutionPolicy = conflictResolutionPolicy;
 }
        public ReportManager()
        {
            client = new MobileServiceClient(Constants.ApplicationURL);

            reportTable = client.GetTable <Report>();
        }
예제 #40
0
        public async Task ErrorMessageConstruction()
        {
            string appUrl     = "http://www.test.com";
            string appKey     = "secret...";
            string collection = "tests";
            string query      = "$filter=id eq 12";

            TestServiceFilter   hijack  = new TestServiceFilter();
            MobileServiceClient service = new MobileServiceClient(appUrl, appKey)
                                          .WithFilter(hijack);

            // Verify the error message is correctly pulled out
            hijack.Response.Content =
                new JsonObject()
                .Set("error", "error message")
                .Set("other", "donkey")
                .Stringify();
            hijack.Response.StatusCode        = 401;
            hijack.Response.StatusDescription = "YOU SHALL NOT PASS.";
            try
            {
                IJsonValue response = await service.GetTable(collection).ReadAsync(query);
            }
            catch (InvalidOperationException ex)
            {
                Assert.Contains(ex.Message, "error message");
            }

            // Verify all of the exception parameters
            hijack.Response.Content =
                new JsonObject()
                .Set("error", "error message")
                .Set("other", "donkey")
                .Stringify();
            hijack.Response.StatusCode        = 401;
            hijack.Response.StatusDescription = "YOU SHALL NOT PASS.";
            try
            {
                IJsonValue response = await service.GetTable(collection).ReadAsync(query);
            }
            catch (MobileServiceInvalidOperationException ex)
            {
                Assert.StartsWith(ex.Message, "error message");
                Assert.AreEqual((int)HttpStatusCode.Unauthorized, ex.Response.StatusCode);
                Assert.Contains(ex.Response.Content, "donkey");
                Assert.StartsWith(ex.Request.Uri.ToString(), appUrl);
                Assert.AreEqual("YOU SHALL NOT PASS.", ex.Response.StatusDescription);
            }

            // If no error message in the response, we'll use the
            // StatusDescription instead
            hijack.Response.Content =
                new JsonObject()
                .Set("other", "donkey")
                .Stringify();
            try
            {
                IJsonValue response = await service.GetTable(collection).ReadAsync(query);
            }
            catch (InvalidOperationException ex)
            {
                Assert.StartsWith(ex.Message, "YOU SHALL NOT PASS.");
            }
        }
예제 #41
0
 private GoodsController()
 {
     MobileService = new MobileServiceClient("https://some.azurewebsites.net");
     GoodsTable    = MobileService.GetTable <Goods>();
     List          = new List <Goods>();
 }
예제 #42
0
 private AzureManager(String URL)
 {
     Client = GetAzureClient(URL);
 }
예제 #43
0
 static RoverServices()
 {
     Client = new MobileServiceClient("https://testrover.azurewebsites.net");
 }
예제 #44
0
 private DatabaseHandler()
 {
     this.client     = new MobileServiceClient("http://FabrikamFoodApp.azurewebsites.net");
     this.UsersTable = this.client.GetTable <Users>();
 }
예제 #45
0
 private AzureManager()
 {
     this.client         = new MobileServiceClient("http://bigthing.azurewebsites.net");
     this.sentimentTable = this.client.GetTable <BigThingModel>();
 }
예제 #46
0
 public async Task LoginAsync(MobileServiceClient client)
 {
     await client.LoginAsync(context, MobileServiceAuthenticationProvider.Google, "olyfaunt");
 }
예제 #47
0
 public iotCloudTable(MobileServiceClient client)
 {
     _client = client;
     _table  = _client.GetTable <T>();
 }
예제 #48
0
 public AzureDataService()
 {
     MobileService = new MobileServiceClient(AppSettings.AzureMobileApp, null);
 }
 public MobileServiceHelper(MobileServiceClient client)
 {
     _client = client;
 }
예제 #50
0
 private AzureManager()
 {
     this.client = new MobileServiceClient("http://xizhescontosobank.azurewebsites.net");
     this.xizhesContosoBankTable = this.client.GetTable <xizhesContosoBank>();
 }
예제 #51
0
 public CharacterService()
 {
     Client         = new MobileServiceClient(Constants.MobileServiceClientUrl);
     CharacterTable = Client.GetTable <Character>();
 }
예제 #52
0
 private TaskManager()
 {
     mobileService = new MobileServiceClient("https://YOUR-SERVICE.azure-mobile.net/", "YOUR-KEY");
     table         = mobileService.GetTable <UserTask>();
     items         = new List <UserTask>();
 }
예제 #53
0
 public AzureCloudTable(MobileServiceClient client)
 {
     this.table = client.GetTable <T> ();
 }
예제 #54
0
 public ConsultTableDatabaseAzure()
 {
     azureDatabase  = Mvx.Resolve <IAzureDatabase>().GetMobileServiceClient("ConsultTable");
     azureSyncTable = azureDatabase.GetSyncTable <ConsultTable>();
 }
예제 #55
0
 public BoardServerAccess()
 {
     this.MobileService = base.MobileService;
 }
예제 #56
0
 public WelcomeData(Context context)
 {
     this.context = context;
     client       = new MobileServiceClient(GlobalValues.AppURL);
     userTable    = client.GetTable <Manboss_usuario>();
 }
 public async Task Login(MobileServiceClient client)
 {
     await client.LoginAsync(context, "twitter");
 }
 public AzureMobileClient()
 {
     client = new MobileServiceClient("<URL backend Azure>);
     
     
 }
예제 #59
0
 private MainTableManager()
 {
     this.client    = new MobileServiceClient(Constants.ApplicationURL);
     this.mainTable = client.GetTable <MainTable>();
 }
예제 #60
0
 public MainPage()
 {
     InitializeComponent();
     cliente = new MobileServiceClient(AzureConnection.AzureURL);
 }