public void AddRemoveDocumentsFromEnvelopeTest() { var envelope = new Envelope { Login = _account }; // add a draft envelope to be found later Assert.IsTrue(envelope.Create()); Assert.IsNull(envelope.RestError); // no docs yet Assert.AreEqual(0, envelope.GetDocIds(envelope.EnvelopeId).Count); // add a doc byte[] doc1 = { 36, 45, 34, 67, 121, 87, 99, 32, 32, 32, 54, 54, 55, 56, 32 }; Assert.IsTrue(envelope.AddDocument(doc1, "test1.doc", 1)); Assert.IsNull(envelope.RestError); // we should have exactly 1 doc now Assert.AreEqual(1, envelope.GetDocIds(envelope.EnvelopeId).Count); Assert.AreEqual("test1.doc", envelope.GetDocNames(envelope.EnvelopeId).First()); var envelopeDocuments = envelope.GetEnvelopeDocumentInfo(envelope.EnvelopeId); Assert.AreEqual(envelopeDocuments.envelopeId, envelope.EnvelopeId); Assert.AreEqual(envelopeDocuments.envelopeDocuments[0].name, "test1.doc"); Assert.AreEqual(envelopeDocuments.envelopeDocuments[0].documentId, "1"); // remove the doc Assert.IsTrue(envelope.RemoveDocument(1)); Assert.IsNull(envelope.RestError); // back to having no docs Assert.AreEqual(0, envelope.GetDocIds(envelope.EnvelopeId).Count); }
protected override void Execute(CodeActivityContext context) { Envelope env = Envelope.Get(context); string name = Name.Get(context); string filename = Filename.Get(context); Document doc = new Document(name, filename); env.AddDocument(doc); Document.Set(context, doc); }