private async void OnClickTwitterLoginAndRefresh(object sender, EventArgs eventArgs)
        {
            var client = new MobileServiceClient(this.uriText.Text);
            var user = await client.LoginAsync(this, MobileServiceAuthenticationProvider.Twitter);

            try
            {
                await client.RefreshUserAsync();
            }
            catch (MobileServiceInvalidOperationException ex)
            {
                Assert.IsNotNull(ex.InnerException);
                Assert.AreEqual(HttpStatusCode.BadRequest, ex.Response.StatusCode);
                Assert.AreEqual(RefreshUser400ErrorMessage, ex.Message);
                string message = "Twitter LoginAsync succeeded. RefreshAsync is not supported by Twitter. UserId: " + user.UserId;
                this.loginTestResult.Text = message;
                System.Diagnostics.Debug.WriteLine(message);
                return;
            }

            Assert.Fail("RefreshAsync() should throw 400 error on Twitter account.");
        }
        private async void OnClickGoogleLoginAndRefresh(object sender, EventArgs eventArgs)
        {
            this.loginTestResult.Text = string.Empty;

            var client = new MobileServiceClient(this.uriText.Text);
            var user = await client.LoginAsync(this, MobileServiceAuthenticationProvider.Google,
                new Dictionary<string, string>()
                {
                    { "access_type", "offline" }
                });
            string authToken = user.MobileServiceAuthenticationToken;
            this.loginTestResult.Text = "Google LoginAsync succeeded. UserId: " + user.UserId;

            MobileServiceUser refreshedUser = await client.RefreshUserAsync();

            Assert.AreEqual(user.UserId, refreshedUser.UserId);
            Assert.AreNotEqual(authToken, refreshedUser.MobileServiceAuthenticationToken);

            string message = "Google LoginAsync succeeded. Google RefreshAsync succeeded. UserId: " + user.UserId;
            this.loginTestResult.Text = message;
            System.Diagnostics.Debug.WriteLine(message);
        }
        private async void OnClickMicrosoftAccountLoginAndRefresh(object sender, EventArgs eventArgs)
        {
            this.loginTestResult.Text = string.Empty;

            var client = new MobileServiceClient(this.uriText.Text);
            var user = await client.LoginAsync(this, MobileServiceAuthenticationProvider.MicrosoftAccount);
            string authToken = user.MobileServiceAuthenticationToken;
            this.loginTestResult.Text = "MicrosoftAccount LoginAsync succeeded. UserId: " + user.UserId;

            MobileServiceUser refreshedUser = await client.RefreshUserAsync();

            Assert.AreEqual(user.UserId, refreshedUser.UserId);
            Assert.AreNotEqual(authToken, refreshedUser.MobileServiceAuthenticationToken);

            string message = "MicrosoftAccount LoginAsync succeeded. MicrosoftAccount RefreshAsync succeeded. UserId: " + user.UserId;
            this.loginTestResult.Text = message;
            System.Diagnostics.Debug.WriteLine(message);
        }
        private async void LoginAndRefreshWithMicrosoftAccount()
        {
            var client = new MobileServiceClient(this.uriEntry.Value);
            MobileServiceUser user = await client.LoginAsync(this, MobileServiceAuthenticationProvider.MicrosoftAccount);
            string authToken = user.MobileServiceAuthenticationToken;

            MobileServiceUser refreshedUser = await client.RefreshUserAsync();

            Assert.AreEqual(user.UserId, refreshedUser.UserId);
            Assert.AreNotEqual(authToken, refreshedUser.MobileServiceAuthenticationToken);

            var alert = new UIAlertView("Welcome", "Microsoft Account Login and Refresh User succeeded. Your userId is: " + user.UserId, null, "OK");
            alert.Show();
        }
        private async void LoginAndRefreshWithGoogle()
        {
            var client = new MobileServiceClient(this.uriEntry.Value);
            MobileServiceUser user = await client.LoginAsync(this, MobileServiceAuthenticationProvider.Google,
                new Dictionary<string, string>()
                {
                    { "access_type", "offline" }
                });
            string authToken = user.MobileServiceAuthenticationToken;

            MobileServiceUser refreshedUser = await client.RefreshUserAsync();

            Assert.AreEqual(user.UserId, refreshedUser.UserId);
            Assert.AreNotEqual(authToken, refreshedUser.MobileServiceAuthenticationToken);

            var alert = new UIAlertView("Welcome", "Google Login and Refresh User succeeded. Your userId is: " + user.UserId, null, "OK");
            alert.Show();
        }
        private async void LoginAndRefreshWithAAD()
        {
            var client = new MobileServiceClient(this.uriEntry.Value);
            MobileServiceUser user = await client.LoginAsync(this, MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory,
                new Dictionary<string, string>()
                {
                    { "response_type", "code id_token" }
                });
            string authToken = user.MobileServiceAuthenticationToken;

            MobileServiceUser refreshedUser = await client.RefreshUserAsync();

            Assert.AreEqual(user.UserId, refreshedUser.UserId);
            Assert.AreNotEqual(authToken, refreshedUser.MobileServiceAuthenticationToken);

            var alert = new UIAlertView("Welcome", "AAD Login and Refresh User succeeded. Your userId is: " + user.UserId, null, "OK");
            alert.Show();
        }