protected void BtnSave_OnClick(object sender, EventArgs e)
        {
            _credentialsStore = GcDynamicUtilities.RetrieveStore <GcDynamicCredentials>();
            var apiKey       = txtApiKey.Text;
            var emailAddress = txtEmailAddress.Text;

            _client = new GcConnectClient(apiKey, emailAddress);

            if (!_client.GetAccounts().IsNullOrEmpty())
            {
                var selectedAccount = Request.Form["ddlGcAccounts"];
                if (selectedAccount.IsNullOrEmpty())
                {
                    selectedAccount = _client.GetAccounts().ToList().First().Id;
                }
                _credentials = new GcDynamicCredentials(emailAddress, apiKey, selectedAccount);
                GcDynamicUtilities.SaveStore(_credentials);
                Response.Write($"<script>alert('Hello {_client.GetMe().FirstName}! You have successfully connected to" +
                               " the GatherContent API')</script>");
            }
            else
            {
                Response.Write("<script>alert('Invalid Email Address or ApiKey! Try again!')</script>");
                //txtPlatformUrl.Text = "";
                GcDynamicUtilities.ClearStore <GcDynamicCredentials>();
            }
            PopulateForm();
        }
Example #2
0
        public void GetMe_InvalidCredential()
        {
            var invalidCredential = new GcConnectClient("abc",
                                                        "*****@*****.**");
            var meObject = invalidCredential.GetMe();

            Assert.IsNull(meObject);
        }
Example #3
0
        public void GetMeTest()
        {
            var meObject = _clientObject.GetMe();

            Assert.IsNotNull(meObject);
            Assert.AreEqual(meObject.FirstName, _configData.FirstName);
            Assert.AreEqual(meObject.LastName, _configData.LastName);
        }