예제 #1
0
        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"]);
        }
예제 #2
0
        public void T_15_BSONtoJSONDataMap()
        {
            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);

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