Example #1
0
        public void TestUpdateInfo()
        {
            if (!CheckApiKey())
            {
                return;
            }

            var updatedData = new AccountInfoUpdate {
                CompanyName = "Test Company"
            };

            var accountInfo = SendloopManager.Account.GetInfo();
            var resUpdate   = SendloopManager.Account.UpdateInfo(updatedData);

            Assert.IsTrue(resUpdate.Success);
            Assert.IsTrue(accountInfo.Success);
            TestUpdateInfoCompareValues(updatedData, accountInfo);

            updatedData.CompanyName = accountInfo.AccountInfo.CompanyName;

            resUpdate   = SendloopManager.Account.UpdateInfo(updatedData);
            accountInfo = SendloopManager.Account.GetInfo();

            TestUpdateInfoCompareValues(updatedData, accountInfo);
        }
Example #2
0
        /// <summary>
        /// Update the Sendloop account information
        /// </summary>
        /// <returns></returns>
        public async Task <ResultAccountInfo> UpdateInfoAsync(AccountInfoUpdate model)
        {
            var arry = new Dictionary <string, string>();

            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.FirstName), model.FirstName);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.City), model.City);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.LastName), model.LastName);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.CompanyName), model.CompanyName);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.Country), model.Country);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.LastName), model.LastName);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.Email), model.Email);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.Fax), model.Fax);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.NewPassword), model.NewPassword);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.Phone), model.Phone);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.State), model.State);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.City), model.City);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.Street), model.Street);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.TimeZone), model.TimeZone);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.Username), model.Username);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.Website), model.Website);
            arry.IfIsNotNullOrEmptyThenAdd(nameof(model.Zip), model.Zip);

            return(await _http.Value.PostAsync <ResultAccountInfo>(SendloopAddress.AccountUpdate, arry));
        }
Example #3
0
        private void TestUpdateInfoCompareValues(AccountInfoUpdate updatedData, ResultAccountInfo accountInfo)
        {
            if (!CheckApiKey())
            {
                return;
            }

            if (updatedData.LastName.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.LastName, updatedData.LastName);
            }

            if (updatedData.FirstName.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.FirstName, updatedData.FirstName);
            }

            if (updatedData.City.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.City, updatedData.City);
            }

            if (updatedData.State.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.State, updatedData.State);
            }

            if (updatedData.CompanyName.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.CompanyName, updatedData.CompanyName);
            }

            if (updatedData.TimeZone.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.TimeZone, updatedData.TimeZone);
            }

            if (updatedData.Street.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.Street, updatedData.Street);
            }

            if (updatedData.Email.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.Email, updatedData.Email);
            }

            if (updatedData.Fax.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.Fax, updatedData.Fax);
            }

            if (updatedData.Website.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.Website, updatedData.Website);
            }

            if (updatedData.Username.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.Username, updatedData.Username);
            }

            if (updatedData.Country.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.Country, updatedData.Country);
            }

            if (updatedData.Phone.IsNotNullOrEmpty())
            {
                Assert.AreEqual(accountInfo.AccountInfo.Phone, updatedData.Phone);
            }
        }
Example #4
0
 /// <summary>
 /// Update the Sendloop account information
 /// </summary>
 /// <returns></returns>
 public ResultAccountInfo UpdateInfo(AccountInfoUpdate model)
 => UpdateInfoAsync(model).GetAwaiter().GetResult();