Esempio n. 1
0
        public void Then1(string batchNumber, Table table)
        {
            var task = CheckThirdPartyBus.GetSingleResponseAsync(5);

            task.Wait();

            response = task.Result;

            Assert.IsNotNull(response, "No response received");
            Assert.IsFalse(string.IsNullOrEmpty(response.voucherBatch.scannedBatchNumber));
            Assert.AreEqual(batchNumber, response.voucherBatch.scannedBatchNumber);

            table.CompareToSet(response.voucher.Select(c => new
            {
                documentReferenceNumber = c.voucher.documentReferenceNumber.Trim(),
                bsbNumber       = c.voucher.bsbNumber.Trim(),
                accountNumber   = c.voucher.accountNumber.Trim(),
                auxDom          = c.voucher.auxDom.Trim(),
                extraAuxDom     = c.voucher.extraAuxDom.Trim(),
                transactionCode = c.voucher.transactionCode.Trim(),
                amount          = c.voucher.amount.Trim(),

                //targetEndPoint = c.voucher.targetEndPoint.Trim(),
                //unprocessable = c.voucher.unprocessable,
                //repostFromDRN = c.voucher.repostFromDRN,
                //repostFromProcessingDate = c.voucher.repostFromProcessingDate.ToString("yyyyMMdd")
            }));
        }
Esempio n. 2
0
        public void When1(Table table)
        {
            var publishInfo = table.CreateInstance <PublishInformation>();

            // synchronous Publish will wait until confirmed publish or timeout exception thrown
            CheckThirdPartyBus.Publish(message, publishInfo.CorrelationId, publishInfo.RoutingKey);

            Thread.Sleep(publishInfo.PublishTimeOutSeconds * 1000);
        }
Esempio n. 3
0
        public void Given1(string batchNumber)
        {
            var batch = batchNumber.PadRight(8, ' ');

            using (var context = CheckThirdPartyBus.CreateContext())
            {
                context.Database.ExecuteSqlCommand("DELETE FROM [Queue] WHERE [S_BATCH] = @p0", batch);
                context.Database.ExecuteSqlCommand("DELETE FROM [NabChq] WHERE [S_BATCH] = @p0", batch);
                context.Database.ExecuteSqlCommand("DELETE FROM [DB_INDEX] WHERE [BATCH] = @p0", batch);
            }
        }
Esempio n. 4
0
        public void Given2(string batchNumber, Table table)
        {
            using (var context = CheckThirdPartyBus.CreateContext())
            {
                var dbRows = table.CreateSet <DipsNabChq>();

                foreach (var dbRow in dbRows)
                {
                    context.NabChqPods.Add(dbRow);
                }

                context.SaveChanges();
            }
        }
Esempio n. 5
0
        public void Then1(Table table)
        {
            var expected = table.CreateInstance <DipsQueue>();

            DipsQueue actual;

            using (var context = CheckThirdPartyBus.CreateContext())
            {
                actual = context.Queues.SingleOrDefault(q => q.S_BATCH == expected.S_BATCH);
            }

            Assert.IsNotNull(actual, "Could not find queue row with batch {0} in the database", expected.S_BATCH);

            TrimAllProperties(actual);

            table.CompareToInstance(actual);
        }
Esempio n. 6
0
        public void Given1(string batchNumber, Table table)
        {
            var batch = batchNumber.PadRight(8, ' ');

            using (var context = CheckThirdPartyBus.CreateContext())
            {
                context.Database.ExecuteSqlCommand("DELETE FROM [Queue] WHERE [S_BATCH] = @p0", batch);
                context.Database.ExecuteSqlCommand("DELETE FROM [NabChq] WHERE [S_BATCH] = @p0", batch);
                context.Database.ExecuteSqlCommand("DELETE FROM [DB_INDEX] WHERE [BATCH] = @p0", batch);

                var queue = table.CreateInstance <DipsQueue>();

                context.Queues.Add(queue);

                context.SaveChanges();
            }
        }
Esempio n. 7
0
        public void Then3(Table table)
        {
            var expected = table.CreateSet <DipsDbIndex>();

            var dbRows = new List <DipsDbIndex>();

            using (var context = CheckThirdPartyBus.CreateContext())
            {
                foreach (var dbIndex in expected)
                {
                    var actual = context.DbIndexes.SingleOrDefault(i => i.BATCH == dbIndex.BATCH && i.TRACE == dbIndex.TRACE);

                    Assert.IsNotNull(actual, string.Format("Could not find DB_INDEX row with batch {0} and trace {1} in the database", dbIndex.BATCH, dbIndex.TRACE));

                    TrimAllProperties(actual);

                    dbRows.Add(actual);
                }
            }

            table.CompareToSet(dbRows);
        }
Esempio n. 8
0
        public void Then2(Table table)
        {
            var expected = table.CreateSet <DipsNabChq>();

            var dbRows = new List <DipsNabChq>();

            using (var context = CheckThirdPartyBus.CreateContext())
            {
                foreach (var chqPod in expected)
                {
                    var actual = context.NabChqPods.SingleOrDefault(c => c.S_BATCH == chqPod.S_BATCH && c.S_TRACE == chqPod.S_TRACE);

                    Assert.IsNotNull(actual, string.Format("Could not find NabChqScanPod row with batch {0} and trace {1} in the database", chqPod.S_BATCH, chqPod.S_TRACE));

                    TrimAllProperties(actual);

                    dbRows.Add(actual);
                }
            }

            table.CompareToSet(dbRows);
        }