예제 #1
0
        /// <summary>
        /// Serializes Json classes into a string
        /// </summary>
        /// <param name="user">NewUser object</param>
        /// <returns>json string</returns>
        private string ConstructNewUserJson(NewUser user)
        {
            try
            {
                if (string.IsNullOrEmpty(user.password.Trim()) == true)
                {
                    Guid g = Guid.NewGuid();
                    user.password = g.ToString();
                }

                AddUsers au = new AddUsers();
                List<NewUser> users = new List<NewUser>();
                users.Add(user);
                au.newUsers = users.ToArray();

                string output = au.Serialize();
                return output;
            }
            catch
            {
                return string.Empty;
            }
        }
        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));
        }
예제 #3
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);
        }