internal JobResponse(directsignaturejobresponse jobResponse)
     : this(
         jobResponse.signaturejobid,
         jobResponse.reference,
         jobResponse.signer.Select(signer => new SignerResponse(signer)),
         jobResponse.statusurl != null ? new StatusUrl(new Uri(jobResponse.statusurl)) : null
         )
 {
 }
예제 #2
0
            public void Converts_direct_job_successfully()
            {
                //Arrange
                const string pin         = "12345678910";
                const string redirectUrl = "https://api.signering.posten.no/redirect/#/c316e5b62df86a5d80e517b3ff4532738a9e7e43d4ae6075d427b1b58355bc63";
                const string signerUrl   = "https://api.signering.posten.no/api/123456789/direct/signature-jobs/1/signers/1";
                const string statusUrl   = "https://api.signering.posten.no/api/signature-jobs/1/status";
                var          source      = new directsignaturejobresponse
                {
                    signaturejobid = 1444,
                    reference      = "senders-reference",
                    redirecturl    = new[] { new signerspecificurl {
                                                 signer = pin, Value = redirectUrl
                                             } },
                    statusurl = statusUrl,
                    signer    = new[]
                    {
                        new directsignerresponse()
                        {
                            href            = signerUrl,
                            ItemElementName = ItemChoiceType1.personalidentificationnumber,
                            redirecturl     = redirectUrl,
                            Item            = pin,
                        },
                    }
                };

                var expected = new JobResponse(
                    source.signaturejobid,
                    source.reference,
                    new List <SignerResponse>()
                {
                    new SignerResponse(new PersonalIdentificationNumber(pin), new Uri(redirectUrl), NewRedirectUrlRequest.FromSignerUrl(new Uri(signerUrl)))
                },
                    new StatusUrl(new Uri(source.statusurl))
                    );

                //Act
                var actual = new JobResponse(source);

                //Assert
                var comparator = new Comparator();

                comparator.AreEqual(expected, actual, out var differences);
                Assert.Empty(differences);
            }