예제 #1
0
            public void Converts_portal_job_with_polling_queue_successfully()
            {
                //Arrange
                var document           = DomainUtility.GetPortalDocument();
                var signers            = DomainUtility.GetSigners(2);
                var reference          = "reference";
                var custompollingqueue = "CustomPollingQueue";
                var sender             = new Sender(BringPublicOrganizationNumber, new PollingQueue(custompollingqueue));
                var source             = new Job(document, signers, reference, sender);

                var expected = new portalsignaturejobrequest
                {
                    reference    = reference,
                    pollingqueue = custompollingqueue
                };

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

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

                comparator.AreEqual(expected, result, out differences);
                Assert.Empty(differences);
            }
            public async Task Throws_exception_on_no_sender()
            {
                //Arrange
                var clientConfiguration = new ClientConfiguration(Environment.DifiQa, GetPostenTestCertificate());
                var portalClient        = new PortalClient(clientConfiguration);
                var portalJob           = new Job(DomainUtility.GetPortalDocument(), DomainUtility.GetSigners(1), "SendersReference");

                //Act
                await Assert.ThrowsAsync <SenderNotSpecifiedException>(async() => await portalClient.Create(portalJob).ConfigureAwait(false)).ConfigureAwait(false);
            }
            public void Simple_constructor()
            {
                //Arrange
                var document  = DomainUtility.GetPortalDocument();
                var signers   = DomainUtility.GetSigners(3);
                var reference = "PortalJobReference";
                var portalJob = new Job(document, signers, reference);

                //Act

                //Assert
                Assert.Equal(document, portalJob.Document);
                Assert.Equal(signers, portalJob.Signers);
                Assert.Equal(reference, portalJob.Reference);
            }
예제 #4
0
            public void Simple_constructor()
            {
                //Arrange
                var sender   = CoreDomainUtility.GetSender();
                var document = DomainUtility.GetPortalDocument();
                var signers  = DomainUtility.GetSigners(2);

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

                //Assert
                Assert.Equal(sender, manifest.Sender);
                Assert.Equal(document, manifest.Document);
                Assert.Equal(signers, manifest.Signers);
            }
예제 #5
0
            public void Converts_manifest_with_availability_successfully()
            {
                //Arrange
                const string organizationNumberSender = "12345678902";

                var source = new Manifest(new Sender(organizationNumberSender), DomainUtility.GetPortalDocument(),
                                          new List <Signer>
                {
                    new Signer(new PersonalIdentificationNumber("01043100358"), new NotificationsUsingLookup()),
                    new Signer(new PersonalIdentificationNumber("01043100319"), new NotificationsUsingLookup())
                })
                {
                    Availability = DomainUtility.GetAvailability()
                };

                var expected = new portalsignaturejobmanifest
                {
                    sender = new sender {
                        organizationnumber = organizationNumberSender
                    },
                    document = new portaldocument
                    {
                        title       = source.Document.Title,
                        description = source.Document.Message,
                        href        = source.Document.FileName,
                        mime        = source.Document.MimeType
                    },
                    signers = new[]
                    {
                        new portalsigner
                        {
                            Item  = ((PersonalIdentificationNumber)source.Signers.ElementAt(0).Identifier).Value,
                            Item1 = new notificationsusinglookup {
                                email = new enabled()
                            },
                            onbehalfof          = signingonbehalfof.SELF,
                            onbehalfofSpecified = true,
                        },
                        new portalsigner
                        {
                            Item  = ((PersonalIdentificationNumber)source.Signers.ElementAt(1).Identifier).Value,
                            Item1 = new notificationsusinglookup {
                                email = new enabled()
                            },
                            onbehalfof          = signingonbehalfof.SELF,
                            onbehalfofSpecified = true,
                        }
                    },
                    availability = new availability
                    {
                        activationtime            = source.Availability.Activation.Value,
                        availableseconds          = source.Availability.AvailableSeconds.Value,
                        activationtimeSpecified   = true,
                        availablesecondsSpecified = true
                    }
                };

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

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

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