public async Task Throws_exception_on_no_sender()
            {
                //Arrange
                var clientConfiguration = new ClientConfiguration(Environment.DifiQa, GetPostenTestCertificate());
                var directClient        = new DirectClient(clientConfiguration);
                var directJob           = new Job(DomainUtility.GetDirectDocument(), DomainUtility.GetSigner(), "SendersReference", DomainUtility.GetExitUrls());

                //Act
                await Assert.ThrowsAsync <SenderNotSpecifiedException>(async() => await directClient.Create(directJob).ConfigureAwait(false)).ConfigureAwait(false);
            }
        internal SignatureGenerator GetSignaturGenerator()
        {
            var document          = DomainUtility.GetDirectDocument();
            var sender            = CoreDomainUtility.GetSender();
            var signers           = DomainUtility.GetSigner();
            var manifest          = new Manifest(sender, document, signers);
            var x509Certificate2  = CoreDomainUtility.GetTestCertificate();
            var signaturGenerator = new SignatureGenerator(x509Certificate2, document, manifest);

            return(signaturGenerator);
        }
            public void SimpleConstructor()
            {
                //Arrange
                var sender   = CoreDomainUtility.GetSender();
                var document = DomainUtility.GetDirectDocument();
                var signer   = DomainUtility.GetSigner();

                //Act
                var manifest = new Manifest(sender, document, signer);

                //Assert
                Assert.Equal(sender, manifest.Sender);
                Assert.Equal(document, manifest.Document);
                Assert.Equal(signer, manifest.Signers);
            }
            public void InitializesWithDocumentDirectManifestAndCertificate()
            {
                //Arrange
                var document         = DomainUtility.GetDirectDocument();
                var sender           = CoreDomainUtility.GetSender();
                var manifest         = new Manifest(sender, document, DomainUtility.GetSigner());
                var x509Certificate2 = CoreDomainUtility.GetTestCertificate();

                //Act
                var signatur = new SignatureGenerator(x509Certificate2, document, manifest);

                //Assert
                Assert.Equal(document, signatur.Attachables.ElementAt(0));
                Assert.Equal(manifest, signatur.Attachables.ElementAt(1));
                Assert.Equal(x509Certificate2, signatur.Certificate);
            }
            public void Simple_constructor()
            {
                //Arrange
                var id       = "IdDirectJob";
                var signers  = DomainUtility.GetSigner();
                var document = DomainUtility.GetDirectDocument();
                var exitUrls = DomainUtility.GetExitUrls();
                var sender   = CoreDomainUtility.GetSender();

                //Act
                var directJob = new Job(document, signers, id, exitUrls, sender);

                //Assert
                Assert.Equal(id, directJob.Reference);
                Assert.Equal(signers, directJob.Signers);
                Assert.Equal(document, directJob.Document);
                Assert.Equal(exitUrls, directJob.ExitUrls);
                Assert.Equal(sender, directJob.Sender);
            }
예제 #6
0
            public void InitializesClassAndParentProperties()
            {
                //Arrange
                var businessCertificate = CoreDomainUtility.GetTestCertificate();
                var clientConfiguration = CoreDomainUtility.GetClientConfiguration();
                var directJob           = new Job(DomainUtility.GetDirectDocument(), DomainUtility.GetSigner(), "reference", DomainUtility.GetExitUrls(), CoreDomainUtility.GetSender());
                var serializedJob       = SerializeUtility.Serialize(DataTransferObjectConverter.ToDataTransferObject(directJob));

                var asiceBundle = DirectAsiceGenerator.CreateAsice(directJob, businessCertificate, clientConfiguration);

                //Act
                var action = new CreateAction(directJob, asiceBundle);

                //Assert
                Assert.Equal(directJob, action.RequestContent);
                Assert.Equal(serializedJob, action.RequestContentXml.InnerXml);

                Assert.Null(action.MultipartFormDataContent);
            }
            public void Converts_direct_job_successfully_with_polling_queue_successfully()
            {
                var document        = DomainUtility.GetDirectDocument();
                var signer          = DomainUtility.GetSigner();
                var reference       = "reference";
                var exitUrls        = DomainUtility.GetExitUrls();
                var statusretrieval = statusretrievalmethod.WAIT_FOR_CALLBACK;
                var pollingQueue    = new PollingQueue("CustomPollingQueue");
                var sender          = new Sender(BringPublicOrganizationNumber, pollingQueue);

                var source = new Job(
                    document,
                    signer,
                    reference,
                    exitUrls,
                    sender);

                var expected = new directsignaturejobrequest
                {
                    reference = reference,
                    exiturls  = new exiturls
                    {
                        completionurl = source.ExitUrls.CompletionUrl.AbsoluteUri,
                        rejectionurl  = source.ExitUrls.RejectionUrl.AbsoluteUri,
                        errorurl      = source.ExitUrls.ErrorUrl.AbsoluteUri
                    },
                    statusretrievalmethod          = statusretrieval,
                    statusretrievalmethodSpecified = true,
                    pollingqueue = pollingQueue.Name
                };

                //Act
                var result = DataTransferObjectConverter.ToDataTransferObject(source);

                //Assert
                var comparator = new Comparator();
                IEnumerable <IDifference> differences;

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