public void GetAllTempaltesForUserTest()
 {
     var template = new Template { Login = _account };
     var templates = template.GetTemplates();
     Assert.IsNull(template.RestError);
     Assert.IsTrue(templates.Count > 0); 
 }
 public void CreateNewTemplate()
 {
     var template = new Template { Login = _account };
     byte[] doc1 = { 36, 45, 34, 67, 121, 87, 99, 32, 32, 32, 54, 54, 55, 56, 32 };
     var names = new List<string>();
     var docs = new List<byte[]>();
     names.Add("test1.doc");
     docs.Add(doc1);
     Assert.IsTrue(template.CreateTemplate(docs, names, "DocuSign.NET Client Unit Test Template"));
     Assert.IsNull(template.RestError);
     // Note that EnvelopeId for a template is the TemplateId...
     Assert.IsFalse(string.IsNullOrEmpty(template.EnvelopeId));
 }
Пример #3
0
        public DocuSignService(string signAddress, string serviceUrl, string integratorKey, string email, string password)
        {
            RestSettings.Instance.DocuSignAddress = signAddress;
            RestSettings.Instance.WebServiceUrl = serviceUrl;
            RestSettings.Instance.IntegratorKey = integratorKey;

            _account = new Account
            {
                Email = email,
                Password = password
            };

            if (!_account.Login())
            {
                throw new Exception("Login failed!");
            }

            _template = new Template {Login = _account};
        }
 public void TemplateEndToEndTest()
 {
     Assert.IsTrue(string.IsNullOrEmpty(RestSettings.Instance.EmailSubject) == false, "Set the email subject for the envelope");
     var template = new Template { Login = _account };
     byte[] doc1 = { 36, 45, 34, 67, 121, 87, 99, 32, 32, 32, 54, 54, 55, 56, 32 };
     var names = new List<string>();
     var docs = new List<byte[]>();
     names.Add("test1.doc");
     docs.Add(doc1);
     // add recipients
     var signers = new List<Signer>();
     signers.Add(new Signer { email = "*****@*****.**", name = "test test", recipientId = "1", roleName = "signer1", routingOrder = "1" });
     signers.Add(new Signer { recipientId = "2", roleName = "signer2", routingOrder = "1" });
     var recipients = new Recipients { signers = signers.ToArray() };
     template.Recipients = recipients;
     Assert.IsTrue(template.CreateTemplate(docs, names, "DocuSign.NET Client Unit Test Template"));
     Assert.IsNull(template.RestError);
     // Note that EnvelopeId for a template is the TemplateId...
     // start a new envelope 
     var templateId = template.EnvelopeId;
     var envelope = new Envelope { Login = _account };
     Assert.IsTrue(envelope.Create());
     // add the template
     var templates = new List<string>();
     templates.Add(template.EnvelopeId);
     Assert.IsTrue(envelope.AddTemplates(templates));
     Assert.IsNull(template.RestError);
     // update recipients
     recipients.signers[1].name = "test test2";
     recipients.signers[1].email = "*****@*****.**";
     Assert.IsTrue(envelope.UpdateRecipients(recipients, false));
     Assert.IsNull(template.RestError);
     // send envelope
     envelope.Status = "sent";
     Assert.IsTrue(envelope.UpdateStatus());
     Assert.IsNull(template.RestError);
 }