Ejemplo n.º 1
0
        public void GivenTheVoucherProcessMetadataContainsTheFollowingData(Table table)
        {
            var folder = ScenarioContext.Current.Get<string>("folder");
            var voucher = ScenarioContext.Current.Get<Voucher>("voucher");
            var voucherBatch = ScenarioContext.Current.Get<VoucherBatch>("voucherBatch");

            var voucherProcesses = table.CreateSet<VoucherProcess>().ToList();

            if (voucherProcesses.Count() != 1)
            {
                Assert.Inconclusive("Currently only 1 voucherProcess is supported");
            }

            var imageExchangeVoucher = new ImageExchangeVoucher
            {
                voucher = voucher,
                voucherBatch = voucherBatch,
                voucherProcess = voucherProcesses.Single()
            };

            var voucherFilePrefix = string.Format("VOUCHER_{0}_{1}", voucher.processingDate.ToString("ddMMyyyy"), voucher.documentReferenceNumber);
            var voucherFileFullPathAndPrefix = Path.Combine(folder, voucherFilePrefix);

            WriteMetaData(voucherFileFullPathAndPrefix, imageExchangeVoucher);
            WriteImage(voucherFileFullPathAndPrefix, "FRONT");
            WriteImage(voucherFileFullPathAndPrefix, "REAR");
        }
Ejemplo n.º 2
0
        private static void WriteMetaData(string voucherFileFullPathAndPrefix, ImageExchangeVoucher imageExchangeVoucher)
        {
            var voucherMetaDataFile = string.Format("{0}.json", voucherFileFullPathAndPrefix);

            using (var sw = new StreamWriter(voucherMetaDataFile))
            using (JsonWriter writer = new JsonTextWriter(sw))
            {
                JsonSerializerFactory.Get().Serialize(writer, imageExchangeVoucher);
            }
        }