Ejemplo n.º 1
0
        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");

            Console.WriteLine(doc.ToString());

            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"]);
        }
Ejemplo n.º 2
0
        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");

            doc.ToString().See();

            var map = rc.BSONDocumentToJSONMap(doc);

            Aver.AreObjectsEqual(rowA.FirstName, map["FirstName"]);
            Aver.AreObjectsEqual(rowA.LastName, map["LastName"]);
            Aver.AreObjectsEqual(rowA.Age, map["Age"]);
        }