Ejemplo n.º 1
0
 public void Then3(string batchNumber)
 {
     using (var context = CorrectCodelineBus.CreateContext())
     {
         Assert.IsTrue(context.DbIndexes.Any(i => i.BATCH == batchNumber));
     }
 }
        public void Then1(string batchNumber, Table table)
        {
            var task = CorrectCodelineBus.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.documentReferenceNumber.Trim(),
                bsbNumber                = c.bsbNumber.Trim(),
                accountNumber            = c.accountNumber.Trim(),
                auxDom                   = c.auxDom.Trim(),
                extraAuxDom              = c.extraAuxDom.Trim(),
                transactionCode          = c.transactionCode.Trim(),
                amount                   = c.amount.Trim(),
                targetEndPoint           = c.targetEndPoint.Trim(),
                unprocessable            = c.unprocessable,
                repostFromDRN            = c.repostFromDRN,
                repostFromProcessingDate = (c.repostFromProcessingDate == null) ? string.Empty : ((System.DateTime)c.repostFromProcessingDate).ToString("yyyyMMdd"),
                collectingBank           = c.collectingBank
            }));
        }
Ejemplo n.º 3
0
        public void When1(Table table)
        {
            var publishInfo = table.CreateInstance <PublishInformation>();

            message.jobIdentifier = publishInfo.CorrelationId;

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

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

            using (var context = CorrectCodelineBus.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);
            }
        }
        public void Given2(string batchNumber, Table table)
        {
            using (var context = CorrectCodelineBus.CreateContext())
            {
                var dbRows = table.CreateSet <DipsNabChq>();

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

                context.SaveChanges();
            }
        }
        public void Given1(string batchNumber, Table table)
        {
            var batch = batchNumber.PadRight(8, ' ');

            using (var context = CorrectCodelineBus.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();
            }
        }
Ejemplo n.º 7
0
        public void Then1(Table table)
        {
            var expected = table.CreateInstance <DipsQueue>();

            DipsQueue actual;

            using (var context = CorrectCodelineBus.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);
        }
Ejemplo n.º 8
0
        public void Then2(Table table)
        {
            var expected = table.CreateSet <DipsNabChq>();

            var dbRows = new List <DipsNabChq>();

            using (var context = CorrectCodelineBus.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);
        }
Ejemplo n.º 9
0
        public void Then3(Table table)
        {
            var expected = table.CreateSet <DipsDbIndex>();

            var dbRows = new List <DipsDbIndex>();

            using (var context = CorrectCodelineBus.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);
        }