Beispiel #1
0
        public async Task <JobResponse> Create(Job job)
        {
            job.Sender = CurrentSender(job.Sender);
            var relativeUrl = RelativeUrl(job.Sender, JobType.Direct, HttpMethod.Post);

            var documentBundle    = DirectAsiceGenerator.CreateAsice(job, ClientConfiguration.Certificate, ClientConfiguration);
            var createAction      = new CreateAction(job, documentBundle);
            var directJobResponse = await RequestHelper.Create(relativeUrl, createAction.Content(), CreateAction.DeserializeFunc).ConfigureAwait(false);

            _logger.LogDebug($"Successfully created Direct Job with JobId: {directJobResponse.JobId}.");

            return(directJobResponse);
        }
Beispiel #2
0
            public async Task Throws_exception_on_invalid_manifest_in_attachment()
            {
                //Arrange
                var client = GetClientWithRequestValidator(new FakeHttpClientForDataResponse());

                var serializedfunc = new Func <IRequestContent, string>(p => ContentUtility.GetDirectSignatureJobRequestBody());

                var manifestBytes = Encoding.UTF8.GetBytes(XmlResource.Request.GetPortalManifest().OuterXml);
                var asiceArchive  = new AsiceArchive(new List <AsiceAttachableProcessor>());

                asiceArchive.AddAttachable("manifest.xml", manifestBytes);
                var documentBundle = new DocumentBundle(asiceArchive.GetBytes());

                var createAction = new CreateAction(new FakeJob(), documentBundle, serializedfunc);

                //Act
                await Assert.ThrowsAsync <InvalidXmlException>(async() => await client.SendAsync(GetHttpRequestMessage(createAction.Content())).ConfigureAwait(false)).ConfigureAwait(false);

                //Assert
            }