public void ThenThereWillBeAMessageInLombard_Service_Outclearings_Recognisecourtesyamount_Response_QueueWithJobIdentifierAndFollowingCARResult(string jobId, Table table)
        {
            var vouchers = table.CreateSet<RecogniseCourtesyAmountResponse>();

            var expectedMessage = new RecogniseBatchCourtesyAmountResponse
            {
                jobIdentifier = jobId,
                voucher = vouchers.ToArray()
            };

            var task = AutoReadCarBus.GetSingleResponseAsync(10, jobId);
            task.Wait();

            var response = task.Result;

            Assert.IsNotNull(response);
            Assert.AreEqual(expectedMessage.jobIdentifier, response.jobIdentifier);
            Assert.AreEqual(expectedMessage.voucher.Length, response.voucher.Length);

            table.CompareToSet(response.voucher);
        }
Esempio n. 2
0
 private static void OcrService_BatchComplete(object sender, OcrBatch batch)
 {
     //Console.WriteLine("Batch {0} completed", batch.JobIdentifier);
     // publish result to outgoing queue/exchange
     var messageBatch = new RecogniseBatchCourtesyAmountResponse
     {
         jobIdentifier = batch.JobIdentifier,
         voucher = batch.Vouchers.Select(v => new RecogniseCourtesyAmountResponse
         {
             documentReferenceNumber = v.Id,
             capturedAmount = v.AmountResult.Result ?? "0",
             amountConfidenceLevel = v.AmountResult.Score ?? "0",
             amountRegionOfInterest = new RegionOfInterest
             {
                 height = v.AmountResult.Location.Height,
                 left = v.AmountResult.Location.Left,
                 top = v.AmountResult.Location.Top,
                 width = v.AmountResult.Location.Width
             }
         }).ToArray()
     };
     //MessageBus.Publish(messageBatch, RoutingKey);
     //Queue.PublishToExchange(OutboundExchangeName, batch.JobIdentifier, RoutingKey, CustomJsonSerializer.MessageToBytes(messageBatch));
     Exchange.SendMessage(CustomJsonSerializer.MessageToBytes(messageBatch), RoutingKey, batch.JobIdentifier);
 }