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_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_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); }