public void Converts_manifest_with_signature_type_successfully() { //Arrange const string organizationNumberSender = "12345678902"; const string documentSubject = "Subject"; const string documentMessage = "Message"; var pdfDocumentBytes = GetPdfDocumentBytes(); var personalIdentificationNumber = "12345678901"; var expectedMimeType = "application/pdf"; var source = new Manifest( new Sender(organizationNumberSender), new Document(documentSubject, documentMessage, FileType.Pdf, pdfDocumentBytes), new[] { new Signer(new PersonalIdentificationNumber(personalIdentificationNumber)) { SignatureType = SignatureType.AdvancedSignature } } ); var expected = new directsignaturejobmanifest { sender = new sender { organizationnumber = organizationNumberSender }, document = new directdocument { title = documentSubject, description = documentMessage, href = source.Document.FileName, mime = expectedMimeType }, signer = new[] { new directsigner { ItemElementName = ItemChoiceType.personalidentificationnumber, Item = personalIdentificationNumber, signaturetype = signaturetype.ADVANCED_ELECTRONIC_SIGNATURE, signaturetypeSpecified = true, onbehalfof = signingonbehalfof.SELF, onbehalfofSpecified = true } } }; //Act var result = DataTransferObjectConverter.ToDataTransferObject(source); //Assert var comparator = new Comparator(); IEnumerable <IDifference> differences; comparator.AreEqual(expected, result, out differences); Assert.Empty(differences); }
internal static directsignaturejobmanifest ToDataTransferObject(Manifest manifest) { var dataTransferObject = new directsignaturejobmanifest { sender = ToDataTransferObject(manifest.Sender), document = ToDataTransferObject((Document)manifest.Document), signer = ToDataTransferObject(manifest.Signers.Cast <Signer>().ToArray()) }; if (manifest.AuthenticationLevel != null) { dataTransferObject.requiredauthentication = manifest.AuthenticationLevel.Value.ToAuthenticationlevel(); dataTransferObject.requiredauthenticationSpecified = true; } if (manifest.IdentifierInSignedDocuments != null) { dataTransferObject.identifierinsigneddocuments = manifest.IdentifierInSignedDocuments.Value.ToIdentifierInSignedDocuments(); dataTransferObject.identifierinsigneddocumentsSpecified = true; } return(dataTransferObject); }