public void Given1(string batchNumber) { var batch = batchNumber.PadRight(8, ' '); using (var context = ValidateCodelineBus.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 = ValidateCodelineBus.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 = ValidateCodelineBus.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(); } }
public void Then1(Table table) { var expected = table.CreateInstance <DipsQueue>(); DipsQueue actual; using (var context = ValidateCodelineBus.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); }
public void Then3(Table table) { var expected = table.CreateSet <DipsDbIndex>(); var dbRows = new List <DipsDbIndex>(); using (var context = ValidateCodelineBus.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); }
public void Then2(Table table) { var expected = table.CreateSet <DipsNabChq>(); var dbRows = new List <DipsNabChq>(); using (var context = ValidateCodelineBus.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); }