public void GetVerifiedDomains_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            List <VerifiedDomain> domains = mc.GetVerifiedDomains();

            //  Assert
            Debug.WriteLine(domains.Count);
            Assert.AreNotEqual(0, domains.Count);
        }
Exemple #2
0
        /// <summary>
        /// Validate Nexmo Settings and MailChimp Settings
        /// </summary>
        /// <returns>true or false</returns>
        public bool ValidateFields()
        {
            if (string.IsNullOrEmpty(txtNexmoAPI.Text.Trim()))
            {
                MessageBox.Show("Please enter the Nexmo Key.", "Nexmo Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtNexmoAPI.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtNexmoSecretKey.Text.Trim()))
            {
                MessageBox.Show("Please enter the Nexmo Secret. ", "Nexmo Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtNexmoSecretKey.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtMailChimpAPI.Text.Trim()))
            {
                MessageBox.Show("Please enter the MailChimp Api Key. ", "MailChimp Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtMailChimpAPI.Focus();
                return(false);
            }

            try
            {
                string fromNumber = SmsSender.GetAccountNumber(txtNexmoAPI.Text.Trim(), txtNexmoSecretKey.Text.Trim());
                if (string.IsNullOrEmpty(fromNumber.Trim()))
                {
                    MessageBox.Show("Not found MISDN number in Nexmo.", "Nexmo Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(false);
                }
                else
                {
                    FromNumber = fromNumber;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please enter valid Nexmo Key and Secret.", "Nexmo Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            try
            {
                MailChimpManager mc = new MailChimpManager(txtMailChimpAPI.Text.Trim());
                var ss = mc.GetVerifiedDomains();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please enter valid MailChimp API Key.", "MailChimp Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            return(true);
        }
        /// <summary>
        /// Validate Nexmo Settings and MailChimp Settings
        /// </summary>
        /// <returns>true or false</returns>
        public bool ValidateFields()
        {
            if (string.IsNullOrEmpty(txtNexmoAPI.Text.Trim()))
            {
                MessageBox.Show("Please enter the Nexmo Key.", "Nexmo Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtNexmoAPI.Focus();
                return false;
            }
            if (string.IsNullOrEmpty(txtNexmoSecretKey.Text.Trim()))
            {
                MessageBox.Show("Please enter the Nexmo Secret. ", "Nexmo Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtNexmoSecretKey.Focus();
                return false;
            }
            if (string.IsNullOrEmpty(txtMailChimpAPI.Text.Trim()))
            {
                MessageBox.Show("Please enter the MailChimp Api Key. ", "MailChimp Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtMailChimpAPI.Focus();
                return false;
            }

            try
            {
                string fromNumber = SmsSender.GetAccountNumber(txtNexmoAPI.Text.Trim(), txtNexmoSecretKey.Text.Trim());
                if (string.IsNullOrEmpty(fromNumber.Trim()))
                {
                    MessageBox.Show("Not found MISDN number in Nexmo.", "Nexmo Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return false;
                }
                else
                {
                    FromNumber = fromNumber;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please enter valid Nexmo Key and Secret.", "Nexmo Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;
            }
            try
            {
                MailChimpManager mc = new MailChimpManager(txtMailChimpAPI.Text.Trim());
                var ss = mc.GetVerifiedDomains();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Please enter valid MailChimp API Key.", "MailChimp Settings", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return false;
            }
            return true;
        }
        public void GetVerifiedDomains_Successful()
        {
            //  Arrange
            MailChimpManager mc = new MailChimpManager(TestGlobal.Test_APIKey);

            //  Act
            List<VerifiedDomain> domains = mc.GetVerifiedDomains();

            //  Assert
            Debug.WriteLine(domains.Count);
            Assert.AreNotEqual(0, domains.Count);
        }