Commits

Anonymous committed 6551473

all test passed

  • Participants
  • Parent commits 827f881

Comments (0)

Files changed (2)

File Usually/Resolve.cs

                             : this.ResolveForStatic(j);
                 foreach (var t in details)
                 {
-                    this.SetActualMasterKey(t, actualKey);
-                    yield return t;
+                    if (t != j.Record) yield return t;
+                    else
+                    {
+                        var tt = t.CloneRecord();
+                        this.SetActualMasterKey(tt, actualKey);
+                        yield return tt;
+                    }
                 }
             }
         }

File UsuallyTests/TestResolve.cs

         }
     }
 
-    public class TestResolve
+    public class TestBase
     {
         public static void ForMaster<M>(List<M> list, M master, Action<M> act)
         {
             Assert.True(records.MoveNext());
             AssertDelete(records.Current, tableName, keyName, keyValue);
         }
+        public static Func<string, object> CreateGenerator()
+        {
+            var nextIds = new Dictionary<string, int>();
+            return (n) =>
+            {
+                int i = 0;
+                if (!nextIds.TryGetValue(n, out i))
+                {
+                    nextIds[n] = i = (n.Length * 100000) + 1;
+                }
+                nextIds[n] = i + 1;
+                return i;
+            };
+        }
+    }
+
+    public class TestResolve: TestBase
+    {
         private List<OrderLine> olds = null;
         private List<OrderLine> news = null;
         [SetUp]
             Assert.AreEqual(8, this.news.Count);
             var changes = Resolver.Resolve(OrderLine.Meta, olds, news).ToList();
             Assert.AreEqual(8, changes.Count);
-            var e = changes.GetEnumerator() as IEnumerator<TransactionRecord>;            
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(InsertRecord), e.Current);
+            var e = changes.GetEnumerator() as IEnumerator<TransactionRecord>;
+            AssertNextInsert(e, "ORDER_LINES", (d) =>
             {
-                var t = e.Current as InsertRecord;
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(7, t.Values.Count);
-                Assert.AreEqual(11, t.Values["LINE_ID"]);
-                Assert.AreEqual(800, t.Values["LINE_UNIQUE_ID"]);
-                Assert.AreEqual(101, t.Values["ORDER_ID"]);
-                Assert.AreEqual(2001, t.Values["ITEM_ID"]);
-                Assert.AreEqual("Two Oo Oo One", t.Values["ITEM_NAME"]);
-                Assert.AreEqual(2, t.Values["QUANTITY"]);
-                Assert.AreEqual(null, t.Values["UNIT"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(UpdateRecord), e.Current);
+                d["LINE_ID"] = 11;
+                d["LINE_UNIQUE_ID"] = 800;
+                d["ORDER_ID"] = 101;
+                d["ITEM_ID"] = 2001;
+                d["ITEM_NAME"] = "Two Oo Oo One";
+                d["QUANTITY"] = 2;
+                d["UNIT"] = null;
+            });
+            AssertNextUpdate(e, "ORDER_LINES", "LINE_ID", 2, (d) =>
             {
-                var t = e.Current as UpdateRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(2, t.Keys["LINE_ID"]);
-                Assert.AreEqual(2, t.Values.Count);
-                Assert.AreEqual(2002, t.Values["ITEM_ID"]);
-                Assert.AreEqual("Two Oo Oo Two", t.Values["ITEM_NAME"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(UpdateRecord), e.Current);
+                d["ITEM_ID"] = 2002;
+                d["ITEM_NAME"] = "Two Oo Oo Two";
+            });
+            AssertNextUpdate(e, "ORDER_LINES", "LINE_ID", 5, (d) =>
             {
-                var t = e.Current as UpdateRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(5, t.Keys["LINE_ID"]);
-                Assert.AreEqual(1, t.Values.Count);
-                Assert.AreEqual(null, t.Values["QUANTITY"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(UpdateRecord), e.Current);
+                d["QUANTITY"] = null;
+            });
+            AssertNextUpdate(e, "ORDER_LINES", "LINE_ID", 7, (d) =>
             {
-                var t = e.Current as UpdateRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(7, t.Keys["LINE_ID"]);
-                Assert.AreEqual(1, t.Values.Count);
-                Assert.AreEqual("Gallon", t.Values["UNIT"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(InsertRecord), e.Current);
+                d["UNIT"] = "Gallon";
+            });
+            AssertNextInsert(e, "ORDER_LINES", (d) =>
             {
-                var t = e.Current as InsertRecord;
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(7, t.Values.Count);
-                Assert.AreEqual(-1, t.Values["LINE_ID"]);
-                Assert.AreEqual(900, t.Values["LINE_UNIQUE_ID"]);
-                Assert.AreEqual(101, t.Values["ORDER_ID"]);
-                Assert.AreEqual(8008, t.Values["ITEM_ID"]);
-                Assert.AreEqual("Eight Thousand Eight", t.Values["ITEM_NAME"]);
-                Assert.AreEqual(8, t.Values["QUANTITY"]);
-                Assert.AreEqual("Piece", t.Values["UNIT"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(InsertRecord), e.Current);
+                d["LINE_ID"] = -1;
+                d["LINE_UNIQUE_ID"] = 900;
+                d["ORDER_ID"] = 101;
+                d["ITEM_ID"] = 8008;
+                d["ITEM_NAME"] = "Eight Thousand Eight";
+                d["QUANTITY"] = 8;
+                d["UNIT"] = "Piece";
+            });
+            AssertNextInsert(e, "ORDER_LINES", (d) =>
             {
-                var t = e.Current as InsertRecord;
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(7, t.Values.Count);
-                Assert.AreEqual(9, t.Values["LINE_ID"]);
-                Assert.AreEqual(-7, t.Values["LINE_UNIQUE_ID"]);
-                Assert.AreEqual(101, t.Values["ORDER_ID"]);
-                Assert.AreEqual(9009, t.Values["ITEM_ID"]);
-                Assert.AreEqual("Nine Thousand Nine", t.Values["ITEM_NAME"]);
-                Assert.AreEqual(9, t.Values["QUANTITY"]);
-                Assert.AreEqual("Square Metre", t.Values["UNIT"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(DeleteRecord), e.Current);
-            {
-                var t = e.Current as DeleteRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(3, t.Keys["LINE_ID"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(DeleteRecord), e.Current);
-            {
-                var t = e.Current as DeleteRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(6, t.Keys["LINE_ID"]);
-            }
+                d["LINE_ID"] = 9;
+                d["LINE_UNIQUE_ID"] = -7;
+                d["ORDER_ID"] = 101;
+                d["ITEM_ID"] = 9009;
+                d["ITEM_NAME"] = "Nine Thousand Nine";
+                d["QUANTITY"] = 9;
+                d["UNIT"] = "Square Metre";
+            });
+            AssertNextDelete(e, "ORDER_LINES", "LINE_ID", 3);
+            AssertNextDelete(e, "ORDER_LINES", "LINE_ID", 6);
             Assert.False(e.MoveNext());
         }
-        public static Func<string, object> CreateGenerator()
-        {
-            var nextIds = new Dictionary<string, int>();
-            return (n) =>
-            {
-                int i = 0;
-                if (!nextIds.TryGetValue(n, out i))
-                {
-                    nextIds[n] = i = (n.Length * 100000) + 1;
-                }
-                nextIds[n] = i + 1;
-                return i;
-            };
-        }
         [Test]
         public void TestResolveWithGenerator()
         {
-            var r = new Resolver(TestResolve.CreateGenerator());
+            var r = new Resolver(CreateGenerator());
             r.Add(OrderLine.Meta, this.olds, this.news);
             this.Twist(this.news);
             Assert.AreEqual(8, this.news.Count);
             var changes = r.Resolve().ToList();
             Assert.AreEqual(8, changes.Count);
             var e = changes.GetEnumerator() as IEnumerator<TransactionRecord>;
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(InsertRecord), e.Current);
+            AssertNextInsert(e, "ORDER_LINES", (d) =>
             {
-                var t = e.Current as InsertRecord;
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(7, t.Values.Count);
-                Assert.AreEqual(11, t.Values["LINE_ID"]);
-                Assert.AreEqual(800, t.Values["LINE_UNIQUE_ID"]);
-                Assert.AreEqual(101, t.Values["ORDER_ID"]);
-                Assert.AreEqual(2001, t.Values["ITEM_ID"]);
-                Assert.AreEqual("Two Oo Oo One", t.Values["ITEM_NAME"]);
-                Assert.AreEqual(2, t.Values["QUANTITY"]);
-                Assert.AreEqual(null, t.Values["UNIT"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(UpdateRecord), e.Current);
+                d["LINE_ID"] = 11;
+                d["LINE_UNIQUE_ID"] = 800;
+                d["ORDER_ID"] = 101;
+                d["ITEM_ID"] = 2001;
+                d["ITEM_NAME"] = "Two Oo Oo One";
+                d["QUANTITY"] = 2;
+                d["UNIT"] = null;
+            });
+            AssertNextUpdate(e, "ORDER_LINES", "LINE_ID", 2, (d) =>
             {
-                var t = e.Current as UpdateRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(2, t.Keys["LINE_ID"]);
-                Assert.AreEqual(2, t.Values.Count);
-                Assert.AreEqual(2002, t.Values["ITEM_ID"]);
-                Assert.AreEqual("Two Oo Oo Two", t.Values["ITEM_NAME"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(UpdateRecord), e.Current);
+                d["ITEM_ID"] = 2002;
+                d["ITEM_NAME"] = "Two Oo Oo Two";
+            });
+            AssertNextUpdate(e, "ORDER_LINES", "LINE_ID", 5, (d) =>
             {
-                var t = e.Current as UpdateRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(5, t.Keys["LINE_ID"]);
-                Assert.AreEqual(1, t.Values.Count);
-                Assert.AreEqual(null, t.Values["QUANTITY"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(UpdateRecord), e.Current);
+                d["QUANTITY"] = null;
+            });
+            AssertNextUpdate(e, "ORDER_LINES", "LINE_ID", 7, (d) =>
             {
-                var t = e.Current as UpdateRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(7, t.Keys["LINE_ID"]);
-                Assert.AreEqual(1, t.Values.Count);
-                Assert.AreEqual("Gallon", t.Values["UNIT"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(InsertRecord), e.Current);
+                d["UNIT"] = "Gallon";
+            });
+            AssertNextInsert(e, "ORDER_LINES", (d) =>
             {
-                var t = e.Current as InsertRecord;
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(7, t.Values.Count);
-                Assert.AreEqual(1500001, t.Values["LINE_ID"]);
-                Assert.AreEqual(900, t.Values["LINE_UNIQUE_ID"]);
-                Assert.AreEqual(101, t.Values["ORDER_ID"]);
-                Assert.AreEqual(8008, t.Values["ITEM_ID"]);
-                Assert.AreEqual("Eight Thousand Eight", t.Values["ITEM_NAME"]);
-                Assert.AreEqual(8, t.Values["QUANTITY"]);
-                Assert.AreEqual("Piece", t.Values["UNIT"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(InsertRecord), e.Current);
+                d["LINE_ID"] = 1500001;
+                d["LINE_UNIQUE_ID"] = 900;
+                d["ORDER_ID"] = 101;
+                d["ITEM_ID"] = 8008;
+                d["ITEM_NAME"] = "Eight Thousand Eight";
+                d["QUANTITY"] = 8;
+                d["UNIT"] = "Piece";
+            });
+            AssertNextInsert(e, "ORDER_LINES", (d) =>
             {
-                var t = e.Current as InsertRecord;
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(7, t.Values.Count);
-                Assert.AreEqual(9, t.Values["LINE_ID"]);
-                Assert.AreEqual(1900001, t.Values["LINE_UNIQUE_ID"]);
-                Assert.AreEqual(101, t.Values["ORDER_ID"]);
-                Assert.AreEqual(9009, t.Values["ITEM_ID"]);
-                Assert.AreEqual("Nine Thousand Nine", t.Values["ITEM_NAME"]);
-                Assert.AreEqual(9, t.Values["QUANTITY"]);
-                Assert.AreEqual("Square Metre", t.Values["UNIT"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(DeleteRecord), e.Current);
-            {
-                var t = e.Current as DeleteRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(3, t.Keys["LINE_ID"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(DeleteRecord), e.Current);
-            {
-                var t = e.Current as DeleteRecord;
-                Assert.True(t.AtMostOne);
-                Assert.AreEqual("ORDER_LINES", t.TableName);
-                Assert.AreEqual(1, t.Keys.Count);
-                Assert.AreEqual(6, t.Keys["LINE_ID"]);
-            }
+                d["LINE_ID"] = 9;
+                d["LINE_UNIQUE_ID"] = 1900001;
+                d["ORDER_ID"] = 101;
+                d["ITEM_ID"] = 9009;
+                d["ITEM_NAME"] = "Nine Thousand Nine";
+                d["QUANTITY"] = 9;
+                d["UNIT"] = "Square Metre";
+            });
+            AssertNextDelete(e, "ORDER_LINES", "LINE_ID", 3);
+            AssertNextDelete(e, "ORDER_LINES", "LINE_ID", 6);
             Assert.False(e.MoveNext());
         }
-        [Test]
-        public void TestResolverObject()
-        {
-            var r = new Resolver();
-            var orders = new List<Order>();
-            var lines = new List<OrderLine>();
-            var order = r.Add(Order.Meta, orders, orders);
-            var line = order.Add(OrderLine.Meta, lines, lines);
-        }
     }
 
-    public class TestMultiLevelResolve
+    public class TestMultiLevelResolve: TestBase
     {
         private List<Order> oldOrders = null;
         private List<OrderLine> oldLines = null;
             this.oldOrders = new List<Order>();
             this.oldLines = new List<OrderLine>();
             this.oldShips = new List<Shipment>();
-            TestResolve.ForMaster(this.oldOrders,
+            ForMaster(this.oldOrders,
                 new Order { OrderId = 1, OrderNumber = "N-001", OrderDate = new DateTime(2012, 2, 14), Status = "FINISHED", CustomerId = 1 },
                 (o) => 
                 {
-                    TestResolve.ForMaster(this.oldLines,
+                    ForMaster(this.oldLines,
                         new OrderLine { OrderId = o.OrderId, LineId = 101, UniqueId = 1101, ItemId = 900001, ItemName = "One", Quantity = 10, Unit = "U1" },
                         (ln) => 
                         {
                             });
                         }
                     );
-                    TestResolve.ForMaster(this.oldLines,
+                    ForMaster(this.oldLines,
                         new OrderLine { OrderId = o.OrderId, LineId = 102, UniqueId = 1102, ItemId = 900002, ItemName = "Two", Quantity = 2, Unit = "U2" },
                         (ln) =>
                         {
                             });
                         }
                     );
-                    TestResolve.ForMaster(this.oldLines,
+                    ForMaster(this.oldLines,
                         new OrderLine { OrderId = o.OrderId, LineId = 103, UniqueId = 1103, ItemId = 900003, ItemName = "Three", Quantity = 2, Unit = "U3" },
                         (ln) =>
                         {
                     );
                 }
             );
-            TestResolve.ForMaster(this.oldOrders,
+            ForMaster(this.oldOrders,
                 new Order { OrderId = 2, OrderNumber = "N-002", OrderDate = new DateTime(2012, 2, 19), Status = "ACTIVE", CustomerId = 2 },
                 (o) =>
                 {
-                    TestResolve.ForMaster(this.oldLines,
+                    ForMaster(this.oldLines,
                         new OrderLine { OrderId = o.OrderId, LineId = 201, UniqueId = 2201, ItemId = 900001, ItemName = "One", Quantity = 1, Unit = "U1" },
                         (ln) =>
                         {
                             });
                         }
                     );
-                    TestResolve.ForMaster(this.oldLines,
+                    ForMaster(this.oldLines,
                         new OrderLine { OrderId = o.OrderId, LineId = 202, UniqueId = 2202, ItemId = 900002, ItemName = "Two", Quantity = 2, Unit = "U2" },
                         (ln) =>
                         {
                     );
                 }
             );
-            TestResolve.ForMaster(this.oldOrders,
+            ForMaster(this.oldOrders,
                 new Order { OrderId = 3, OrderNumber = "N-003", OrderDate = new DateTime(2012, 3, 2), Status = "INCOMPLETED", CustomerId = 3 },
                 (o) => 
                 {
-                    TestResolve.ForMaster(this.oldLines,
+                    ForMaster(this.oldLines,
                         new OrderLine { OrderId = o.OrderId, LineId = 301, UniqueId = 3301, ItemId = 900001, ItemName = "One", Quantity = 1, Unit = "U1" },
                         (ln) => 
                         {
         }
         private Resolver CreateResolver()
         {
-            var r = new Resolver(TestResolve.CreateGenerator());
+            var r = new Resolver(CreateGenerator());
             r.Add(Order.Meta, this.oldOrders, this.newOrders
             ).Add(OrderLine.Meta, this.oldLines, this.newLines
             ).Add(Shipment.Meta, this.oldShips, this.newShips);
             this.newShips.RemoveAll((x) => x.ShipmentId == 20102);   // 1 deleted
             this.newLines.RemoveAll((x) => x.LineId == 202);         // 3 deleted
             this.newOrders.RemoveAll((x) => x.OrderId == 3);         // 2 deleted
-            TestResolve.ForMaster(                                               // 9 inserted
+            ForMaster(                                               // 9 inserted
                 this.newOrders,
                 new Order() { OrderId = -4, OrderNumber = "N-004", OrderDate = new DateTime(2012, 3, 5), Status = "ACTIVE", CustomerId = 4 },
                 (o) =>
                 {
-                    TestResolve.ForMaster(this.newLines,
+                    ForMaster(this.newLines,
                         new OrderLine { OrderId = o.OrderId, LineId = -401, UniqueId = -4401, ItemId = 900001, ItemName = "One", Quantity = 10, Unit = "U1" },
                         (ln) =>
                         {
                             });
                         }
                     );
-                    TestResolve.ForMaster(this.newLines,
+                    ForMaster(this.newLines,
                         new OrderLine { OrderId = o.OrderId, LineId = -402, UniqueId = -4402, ItemId = 900002, ItemName = "Two", Quantity = 2, Unit = "U2" },
                         (ln) =>
                         {
             var changes = this.CreateResolver().Resolve().ToList();
             Assert.AreEqual(24, changes.Count);
             var e = changes.GetEnumerator() as IEnumerator<TransactionRecord>;
-            TestResolve.AssertNextUpdate(e, "ORDERS", "ORDER_ID", 1, (d) => 
+            AssertNextUpdate(e, "ORDERS", "ORDER_ID", 1, (d) => 
             { 
                 d["STATUS"] = "ARCHIVED"; 
             });
-            TestResolve.AssertNextUpdate(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10301, (d) =>
+            AssertNextUpdate(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10301, (d) =>
             {
                 d["QUANTITY"] = 54321;
             });
-            TestResolve.AssertNextUpdate(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10302, (d) =>
+            AssertNextUpdate(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10302, (d) =>
             {
                 d["QUANTITY"] = 54321;
             });
-            TestResolve.AssertNextUpdate(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10304, (d) =>
+            AssertNextUpdate(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10304, (d) =>
             {
                 d["QUANTITY"] = 54321;
             });
-            TestResolve.AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10303);
-            TestResolve.AssertNextUpdate(e, "ORDER_LINES", "LINE_ID", 201, (d) =>
+            AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10303);
+            AssertNextUpdate(e, "ORDER_LINES", "LINE_ID", 201, (d) =>
             {
                 d["QUANTITY"] = 12345;
             });
-            TestResolve.AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 20102);
-            TestResolve.AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 20201);
-            TestResolve.AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 20202);
-            TestResolve.AssertNextDelete(e, "ORDER_LINES", "LINE_ID", 202);
-            TestResolve.AssertNextInsert(e, "ORDERS", (d) =>
+            AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 20102);
+            AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 20201);
+            AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 20202);
+            AssertNextDelete(e, "ORDER_LINES", "LINE_ID", 202);
+            AssertNextInsert(e, "ORDERS", (d) =>
             {
                 d["ORDER_ID"] = 1000001;
                 d["ORDER_NUMBER"] = "N-004";
                 d["STATUS"] = "ACTIVE";
                 d["CUSTOMER_ID"] = 4;
             });
-            Assert.True(e.MoveNext());
-            Assert.IsInstanceOf(typeof(InsertRecord), e.Current);
+            AssertNextInsert(e, "ORDER_LINES", (d) =>
             {
-                var t = e.Current as InsertRecord;
-                Assert.AreEqual(t.TableName, "ORDER_LINES");
-                Assert.AreEqual(7, t.Values.Count);
-                Assert.AreEqual(1500001, t.Values["LINE_ID"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            TestResolve.AssertInsert(e.Current, "ORDER_LINES", (d) =>
+                d["ORDER_ID"] = 1000001;
+                d["LINE_ID"] = 1500001;
+                d["LINE_UNIQUE_ID"] = 1900001;
+                d["ITEM_ID"] = 900001;
+                d["ITEM_NAME"] = "One";
+                d["QUANTITY"] = 10;
+                d["UNIT"] = "U1";
+            });
+            AssertNextInsert(e, "ORDER_SHIPMENTS", (d) =>
             {
+                d["ORDER_LINE_ID"] = 1500001;
+                d["SHIPMENT_ID"] = 1900001;
+                d["QUANTITY"] = 1;
+                d["SHIP_DATE"] = new DateTime(2012, 3, 5);
+            });
+            AssertNextInsert(e, "ORDER_SHIPMENTS", (d) =>
+            {
+                d["ORDER_LINE_ID"] = 1500001;
+                d["SHIPMENT_ID"] = 1900002;
+                d["QUANTITY"] = 1;
+                d["SHIP_DATE"] = new DateTime(2012, 3, 5);
+            });
+            AssertNextInsert(e, "ORDER_SHIPMENTS", (d) =>
+            {
+                d["ORDER_LINE_ID"] = 1500001;
+                d["SHIPMENT_ID"] = 1900003;
+                d["QUANTITY"] = 1;
+                d["SHIP_DATE"] = new DateTime(2012, 3, 5);
+            });
+            AssertNextInsert(e, "ORDER_SHIPMENTS", (d) =>
+            {
+                d["ORDER_LINE_ID"] = 1500001;
+                d["SHIPMENT_ID"] = 1900004;
+                d["QUANTITY"] = 1;
+                d["SHIP_DATE"] = new DateTime(2012, 3, 5);
+            });
+            AssertNextInsert(e, "ORDER_LINES", (d) =>
+            {
+                d["ORDER_ID"] = 1000001;
                 d["LINE_ID"] = 1500002;
-                d["ORDER_ID"] = 1000001;
                 d["LINE_UNIQUE_ID"] = 1900002;
                 d["ITEM_ID"] = 900002;
                 d["ITEM_NAME"] = "Two";
                 d["QUANTITY"] = 2;
                 d["UNIT"] = "U2";
             });
-            Assert.IsInstanceOf(typeof(InsertRecord), e.Current);
+            AssertNextInsert(e, "ORDER_SHIPMENTS", (d) =>
             {
-                var t = e.Current as InsertRecord;
-                Assert.AreEqual(t.TableName, "ORDER_LINES");
-                Assert.AreEqual(7, t.Values.Count);
-                Assert.AreEqual(1500002, t.Values["LINE_ID"]);
-            }
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
-            Assert.True(e.MoveNext());
+                d["ORDER_LINE_ID"] = 1500002;
+                d["SHIPMENT_ID"] = 1900005;
+                d["QUANTITY"] = 1;
+                d["SHIP_DATE"] = new DateTime(2012, 3, 5);
+            });
+            AssertNextInsert(e, "ORDER_SHIPMENTS", (d) =>
+            {
+                d["ORDER_LINE_ID"] = 1500002;
+                d["SHIPMENT_ID"] = 1900006;
+                d["QUANTITY"] = 1;
+                d["SHIP_DATE"] = new DateTime(2012, 3, 5);
+            });
+            AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10202);
+            AssertNextDelete(e, "ORDER_SHIPMENTS", "SHIPMENT_ID", 10201);
+            AssertNextDelete(e, "ORDER_LINES", "LINE_ID", 102);
+            AssertNextDelete(e, "ORDER_LINES", "LINE_ID", 301);
+            AssertNextDelete(e, "ORDERS", "ORDER_ID", 3);
             Assert.False(e.MoveNext());
         }
     }