public void T_17_VersionChange_AmorphousExtra() { var BYTES = new byte[] { 0x00, 0x79, 0x14 }; var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; rowA.AmorphousData["AABB"] = "extra data"; rowA.AmorphousData["Bytes"] = BYTES; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A", useAmorphousData: true); Console.WriteLine(doc.ToString()); var rowB = new RowVersionB(); rc.BSONDocumentToRow(doc, rowB, "MyLegacySystem", useAmorphousData: true); Assert.AreEqual("Vladimir", rowB.FirstName); Assert.AreEqual("Lenin", rowB.LastName); Assert.AreEqual(1870, rowB.DOB.Year); Assert.AreEqual("extra data", rowB.AmorphousData["AABB"]); Assert.IsTrue(BYTES.SequenceEqual((byte[])rowB.AmorphousData["Bytes"])); }
public void T_15_BSONtoJSONDataMapFilter() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A"); Console.WriteLine(doc.ToString()); var map = rc.BSONDocumentToJSONMap(doc, (d, e) => e.Name != "LastName"); Assert.AreEqual(rowA.FirstName, map["FirstName"]); Assert.IsNull(map["LastName"]); //filter skipped Assert.AreEqual(rowA.Age, map["Age"]); }
public void T_15_BSONtoJSONDataMap() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new DataDocConverter(); var doc = rc.DataDocToBSONDocument(rowA, "A"); Console.WriteLine(doc.ToString()); var map = rc.BSONDocumentToJSONMap(doc); Aver.AreObjectsEqual(rowA.FirstName, map["FirstName"]); Aver.AreObjectsEqual(rowA.LastName, map["LastName"]); Aver.AreObjectsEqual(rowA.Age, map["Age"]); }
public void T_15_BSONtoJSONDataMapFilter() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new DataDocConverter(); var doc = rc.DataDocToBSONDocument(rowA, "A"); doc.ToString().See(); var map = rc.BSONDocumentToJSONMap(doc, (d, e) => e.Name != "LastName"); Aver.AreObjectsEqual(rowA.FirstName, map["FirstName"]); Aver.IsNull(map["LastName"]); //filter skipped Aver.AreObjectsEqual(rowA.Age, map["Age"]); }
public void T_16_VersionChange_AmorphousDisabled_WithFilter() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A", useAmorphousData: false); Console.WriteLine(doc.ToString()); var rowB = new RowVersionB(); rc.BSONDocumentToRow(doc, rowB, "MyLegacySystem", useAmorphousData: false, filter: (d, e) => e.Name != "LastName"); Assert.AreEqual("Vladimir", rowB.FirstName); Assert.IsNull(rowB.LastName); Assert.AreEqual(new DateTime(), rowB.DOB); }
public void T_08_VersionChange() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A"); Console.WriteLine(doc.ToString()); var rowB = new RowVersionB(); rc.BSONDocumentToRow(doc, rowB, "MyLegacySystem"); Assert.AreEqual("Vladimir", rowB.FirstName); Assert.AreEqual("Lenin", rowB.LastName); Assert.AreEqual(1870, rowB.DOB.Year); }
public void T_16_VersionChange_AmorphousDisabled() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new DataDocConverter(); var doc = rc.DataDocToBSONDocument(rowA, "A", useAmorphousData: false); Console.WriteLine(doc.ToString()); var rowB = new RowVersionB(); rc.BSONDocumentToDataDoc(doc, rowB, "MyLegacySystem", useAmorphousData: false); Aver.AreEqual("Vladimir", rowB.FirstName); Aver.AreEqual("Lenin", rowB.LastName); Aver.AreEqual(new DateTime(), rowB.DOB); }
public void T_08_VersionChange() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new DataDocConverter(); var doc = rc.DataDocToBSONDocument(rowA, "A"); doc.ToString().See(); var rowB = new RowVersionB(); rc.BSONDocumentToDataDoc(doc, rowB, "MyLegacySystem"); Aver.AreEqual("Vladimir", rowB.FirstName); Aver.AreEqual("Lenin", rowB.LastName); Aver.AreEqual(1870, rowB.DOB.Year); }
public void T_17_VersionChange_AmorphousExtra() { var BYTES = new byte[] {0x00, 0x79, 0x14}; var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; rowA.AmorphousData["AABB"] = "extra data"; rowA.AmorphousData["Bytes"] = BYTES; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A", useAmorphousData: true); Console.WriteLine( doc.ToString() ); var rowB = new RowVersionB(); rc.BSONDocumentToRow(doc, rowB, "MyLegacySystem", useAmorphousData: true); Assert.AreEqual("Vladimir", rowB.FirstName); Assert.AreEqual("Lenin", rowB.LastName); Assert.AreEqual(1870, rowB.DOB.Year); Assert.AreEqual("extra data", rowB.AmorphousData["AABB"]); Assert.IsTrue( BYTES.SequenceEqual((byte[])rowB.AmorphousData["Bytes"])); }
public void T_16_VersionChange_AmorphousDisabled_WithFilter() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A", useAmorphousData: false); Console.WriteLine( doc.ToString() ); var rowB = new RowVersionB(); rc.BSONDocumentToRow(doc, rowB, "MyLegacySystem", useAmorphousData: false, filter: (d,e) => e.Name!="LastName"); Assert.AreEqual("Vladimir", rowB.FirstName); Assert.IsNull( rowB.LastName ); Assert.AreEqual(new DateTime(), rowB.DOB); }
public void T_15_BSONtoJSONDataMapFilter() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A"); Console.WriteLine( doc.ToString() ); var map = rc.BSONDocumentToJSONMap(doc, (d, e) => e.Name!="LastName"); Assert.AreEqual(rowA.FirstName, map["FirstName"]); Assert.IsNull( map["LastName"] ); //filter skipped Assert.AreEqual(rowA.Age, map["Age"]); }
public void T_08_VersionChange() { var rowA = new RowVersionA { FirstName = "Vladimir", LastName = "Lenin", Age = DateTime.Now.Year - 1870 }; var rc = new RowConverter(); var doc = rc.RowToBSONDocument(rowA, "A"); Console.WriteLine( doc.ToString() ); var rowB = new RowVersionB(); rc.BSONDocumentToRow(doc, rowB, "MyLegacySystem"); Assert.AreEqual("Vladimir", rowB.FirstName); Assert.AreEqual("Lenin", rowB.LastName); Assert.AreEqual(1870, rowB.DOB.Year); }