Exemple #1
0
        public void AccountCreateAddUser()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("ds client unit test {unique}");
            acct.Email       = Util.MakeUnique("ds_client_unit_{unique}@gmail.com");
            acct.Password    = "******";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            AddUsers       add      = new AddUsers();
            List <NewUser> userList = new List <NewUser>();

            NewUser nu = new NewUser();

            nu.userName = Util.MakeUnique("ds client unit test member {unique}");
            nu.email    = Util.MakeUnique("ds_client_unit_member_{unique}@gmail.com");
            nu.sendActivationOnInvalidLogin = false.ToString();
            nu.enableConnectForUser         = true.ToString();
            Guid g = Guid.NewGuid();

            nu.password = g.ToString();

            List <UserSetting> userSettings = new List <UserSetting>();

            userSettings.Add(new UserSetting("canSendAPIRequests", "true"));
            userSettings.Add(new UserSetting("canSendEnvelope", "true"));
            userSettings.Add(new UserSetting("AllowSendOnBehalfOf", "true"));
            nu.userSettings = userSettings.ToArray();

            userList.Add(nu);
            add.newUsers = userList.ToArray();

            CreatedUsers added = null;

            try
            {
                added = acct.AddUser(add);
            }
            catch (Exception)
            {
            }

            Assert.IsNotNull(added);
        }
        public void InitializeAccount()
        {
            ConfigLoader.LoadConfig();
            //TODO - udpate these values with valid user/password for demo
            string email    = "";
            string password = "";

            _account = new Account {
                Email = email, Password = password
            };
            Assert.IsTrue(_account.Login());
        }
Exemple #3
0
        public void AccountCreate()
        {
            try
            {
                bool expected = true;
                bool actual   = false;

                ConfigLoader.LoadConfig();

                Account acct = new Account();
                //acct.Email = "*****@*****.**";
                //acct.Password = "******";
                //acct.AccountName = "Fester Rester";
                acct.Password = Guid.NewGuid().ToString();

                acct.AccountName = Util.MakeUnique("freakin me out {unique}");
                acct.Email       = Util.MakeUnique("freakin_{unique}@gmail.com");

                //AddressInformation ai = new AddressInformation();
                //acct.Address = ai;
                //ai.address1 = "123 Main ST";
                //ai.address2 = string.Empty;
                //ai.city = "Anytown";
                //ai.country = "USA";
                //ai.postalCode = "11111";
                //ai.state = "WA";

                //CreditCardInformation cc = new CreditCardInformation();
                //acct.CreditCard = cc;
                //cc.cardNumber = "4111 1111 1111 1111";
                //cc.cardType = "visa";
                //cc.expirationMonth = "12";
                //cc.expirationYear = "2015";
                //cc.nameOnCard = "Freak Me Out";

                try
                {
                    actual = acct.Create();
                }
                catch (Exception)
                {
                }

                Assert.AreEqual(expected, actual);
            }
            catch (Exception)
            {
                Assert.IsTrue(true);
            }
        }
Exemple #4
0
        public void AccountLogin()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            // create a new account
            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("freakin me out {unique}");
            acct.Email       = Util.MakeUnique("freakin_{unique}@gmail.com");
            acct.Password    = "******";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
                actual = false;
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(acct.BaseUrl));
            Assert.IsFalse(string.IsNullOrEmpty(acct.ApiPassword));

            actual = false;
            Account acct2 = new Account();

            acct2.AccountName = acct.AccountName;
            acct2.Email       = acct.Email;
            acct2.Password    = acct.Password;

            try
            {
                actual = acct2.Login();
            }
            catch (Exception)
            {
                actual = false;
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(acct.BaseUrl));
            Assert.IsFalse(string.IsNullOrEmpty(acct.ApiPassword));
        }
Exemple #5
0
        public void AccountCreateSocial()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("restclienttest {unique}");
            acct.Email       = Util.MakeUnique("restclienttest_{unique}@gmail.com");
            //acct.AccountName = "Trinity UltraStar";
            //acct.Email = "*****@*****.**";
            acct.Password = Guid.NewGuid().ToString();

            acct.Social          = new SocialAccountInformation();
            acct.Social.email    = acct.Email;
            acct.Social.provider = "Google";
            acct.Social.socialId = Util.MakeUnique("{unique}");
            acct.Social.userName = acct.AccountName;

            try
            {
                actual = acct.Create();
                var trace = acct.RestTrace;

                Assert.AreEqual(expected, actual);

                if (actual == true)
                {
                    actual        = false;
                    acct.Password = string.Empty;
                    acct.Email    = acct.AccountIdGuid.ToString();
                    actual        = acct.Login();
                    trace         = acct.RestTrace;

                    Assert.AreEqual(expected, actual);
                }
            }
            catch (Exception)
            {
                actual = false;
            }

            Assert.AreEqual(expected, actual);
        }
Exemple #6
0
        public void GetPlanDetails()
        {
            ConfigLoader.LoadConfig();

            Plan actual = null;

            Account acct = new Account();

            try
            {
                actual = acct.BillingPlan("8844269c-be6d-4b33-9d9f-f4895fdbbb16");
            }
            catch (Exception)
            {
            }

            Assert.IsNotNull(actual);
        }
Exemple #7
0
        public void EnvelopeCreateNoAccount()
        {
            ConfigLoader.LoadConfig();

            Envelope target   = new Envelope();
            bool     expected = false;
            bool     actual   = false;

            try
            {
                actual = target.Create(string.Empty);
            }
            catch (ArgumentNullException)
            {
            }

            Assert.AreEqual(expected, actual);
        }
Exemple #8
0
        public void EnvelopeCreateNoDocument()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = true;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("freakin me out {unique}");
            acct.Email       = Util.MakeUnique("freakin_{unique}@gmail.com");
            acct.Password    = "******";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(acct.BaseUrl));

            Envelope target = new Envelope();

            target.Login = acct;


            actual = false;

            try
            {
                actual = target.Create(string.Empty);
            }
            catch (ArgumentNullException)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(target.SenderViewUrl));
        }
Exemple #9
0
        public void AccountCreateNoPassword()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("freakin me out {unique}");
            acct.Email       = Util.MakeUnique("freakin_{unique}@gmail.com");
            acct.Password    = string.Empty;

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
                actual = false;
            }

            Assert.AreEqual(expected, actual);
        }
Exemple #10
0
        public void EnvelopeCreateWithDocumentTest()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("freakin me out {unique}");
            acct.Email       = Util.MakeUnique("freakin_{unique}@gmail.com");
            acct.Password    = "******";

            AddressInformation ai = new AddressInformation();

            acct.Address  = ai;
            ai.address1   = "123 Main ST";
            ai.address2   = string.Empty;
            ai.city       = "Anytown";
            ai.country    = "USA";
            ai.postalCode = "11111";
            ai.state      = "WA";

            CreditCardInformation cc = new CreditCardInformation();

            acct.CreditCard    = cc;
            cc.cardNumber      = "4111111111111111";
            cc.cardType        = "visa";
            cc.expirationMonth = "12";
            cc.expirationYear  = "2015";
            cc.nameOnCard      = "Freak Me Out";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(acct.BaseUrl));

            Envelope target = new Envelope();

            target.Login = acct;
            FileInfo fi   = new FileInfo("./Test Contract.pdf");
            string   path = fi.FullName;

            actual = false;

            try
            {
                actual = target.Create(path);
            }
            catch (ArgumentNullException)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(target.SenderViewUrl));
        }
Exemple #11
0
        public void EnvelopeCreateAddMemberWithDocumentTest()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("ds client unit test {unique}");
            acct.Email       = Util.MakeUnique("ds_client_unit_{unique}@gmail.com");
            acct.Password    = "******";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            AddUsers       add      = new AddUsers();
            List <NewUser> userList = new List <NewUser>();

            NewUser nu = new NewUser();

            nu.userName = Util.MakeUnique("ds client unit test member {unique}");
            nu.email    = Util.MakeUnique("ds_client_unit_member_{unique}@gmail.com");
            nu.sendActivationOnInvalidLogin = false.ToString();
            nu.enableConnectForUser         = true.ToString();
            Guid g = Guid.NewGuid();

            nu.password = g.ToString();

            List <UserSetting> userSettings = new List <UserSetting>();

            userSettings.Add(new UserSetting("canSendAPIRequests", "true"));
            userSettings.Add(new UserSetting("canSendEnvelope", "true"));
            userSettings.Add(new UserSetting("AllowSendOnBehalfOf", "true"));
            nu.userSettings = userSettings.ToArray();

            userList.Add(nu);
            add.newUsers = userList.ToArray();

            CreatedUsers added = null;

            try
            {
                added = acct.AddUser(add);
            }
            catch (Exception)
            {
            }

            Account member = new Account();

            member.ApiPassword = added.NewUsers[0].ApiPassword;
            member.AccountId   = added.NewUsers[0].UserId;
            member.Email       = added.NewUsers[0].Email;
            //member.BaseUrl = added.NewUsers[0].Uri;
            bool log = member.Login();

            Assert.IsNotNull(added);
            Envelope target = new Envelope();

            target.Login = member;
            FileInfo fi   = new FileInfo("./Test Contract.pdf");
            string   path = fi.FullName;

            actual = false;

            try
            {
                actual = target.Create(path);
            }
            catch (ArgumentNullException)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(target.SenderViewUrl));
        }
        public void EnvelopeGetRecipients()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = true;

            Account acct = new Account();

            // $TODO: Add creds for known account
            acct.Email       = "";
            acct.Password    = "";
            acct.AccountName = "";

            try
            {
                actual = acct.Login();
            }
            catch (Exception ex)
            {
                Assert.Fail("Unexpected exception during account creation part of test {0}: {1}", ex.GetType(), ex.Message);
                return;
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(acct.BaseUrl));

            Envelope target = new Envelope();

            target.Login = acct;

            // $TODO: add known Envelope ID
            target.EnvelopeId = " 10211DCED6744C13A2B82AACC0AF4BEC";


            actual = false;

            try
            {
                actual = target.GetRecipients();
            }
            catch (Exception ex)
            {
                Assert.Fail("Unexpected exception during test {0}: {1}", ex.GetType(), ex.Message);
                return;
            }

            Assert.AreEqual(expected, actual);

            // $TODO: add Asserts for known Recipient Properties on the envelope
            Assert.IsNotNull(target.Recipients);
            Assert.AreEqual(target.Recipients.recipientCount, "3");
            Assert.AreEqual(target.Recipients.signers[0].email, "*****@*****.**");
            Assert.AreEqual(target.Recipients.signers[0].name, "Test One");
            Assert.AreEqual(target.Recipients.signers[0].status, "sent");
            Assert.AreEqual(target.Recipients.signers[1].email, "*****@*****.**");
            Assert.AreEqual(target.Recipients.signers[1].name, "Test Two");
            Assert.AreEqual(target.Recipients.signers[1].status, "created");
            Assert.AreEqual(target.Recipients.signers[2].email, "*****@*****.**");
            Assert.AreEqual(target.Recipients.signers[2].name, "Test Three");
            Assert.AreEqual(target.Recipients.signers[2].status, "created");
        }
        public void EnvelopeCreateWithSmsAuthenticationDocumentTest()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("freakin me out {unique}");
            acct.Email       = Util.MakeUnique("freakin_{unique}@gmail.com");
            acct.Password    = "******";

            AddressInformation ai = new AddressInformation();

            acct.Address  = ai;
            ai.address1   = "123 Main ST";
            ai.address2   = string.Empty;
            ai.city       = "Anytown";
            ai.country    = "USA";
            ai.postalCode = "11111";
            ai.state      = "WA";

            CreditCardInformation cc = new CreditCardInformation();

            acct.CreditCard    = cc;
            cc.cardNumber      = "4111111111111111";
            cc.cardType        = "visa";
            cc.expirationMonth = "12";
            cc.expirationYear  = "2015";
            cc.nameOnCard      = "Freak Me Out";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(acct.BaseUrl));

            if (expected == actual)
            {
                Envelope target = new Envelope();
                target.Login = acct;

                // add signers to the envelope
                target.Recipients = new Recipients()
                {
                    signers = new Signer[]
                    {
                        new Signer()
                        {
                            email                    = "freakin_{unique}@gmail.com",
                            name                     = "freakin",
                            routingOrder             = "1",
                            recipientId              = "1",
                            requireIdLookup          = "true",
                            idCheckConfigurationName = "SMS Auth $",
                            smsAuthentication        = new SmsAuthentication()
                            {
                                senderProvidedNumbers = new string[]
                                {
                                    String.Format("+{0} {1}", "34", "000000000")
                                }
                            }
                        }
                    }
                };

                // Email subject is a required parameter when requesting signatures
                target.EmailSubject = "Example subject";

                // "sent" to send immediately, "created" to save envelope as draft
                target.Status = "sent";

                FileInfo fi   = new FileInfo("./Test Contract.pdf");
                string   path = fi.FullName;

                actual = false;

                try
                {
                    actual = target.Create(path);
                }
                catch (ArgumentNullException)
                {
                }

                Assert.AreEqual(expected, actual);
                Assert.IsFalse(string.IsNullOrEmpty(target.SenderViewUrl));
            }
        }