Ejemplo n.º 1
0
        public void T_06_TargetingInnerRows()
        {
            var row = new RowB {
                Row1 = new RowA  {
                    String1 = "Mudaker", String2 = "Someone"
                },
                Row2 = new RowA  {
                    String1 = "Zar", String2 = "Boris"
                }
            };

            var rc = new RowConverter();

            var doc = rc.RowToBSONDocument(row, "A");

            Console.WriteLine(doc.ToString());
            Assert.AreEqual("Someone", doc["Row1"]["s2"].ToString());
            Assert.AreEqual("Boris", doc["Row2"]["s2"].ToString());

            doc = rc.RowToBSONDocument(row, "B");
            Console.WriteLine(doc.ToString());
            Assert.AreEqual("Someone", doc["Row1"]["STRING-2"].ToString());
            Assert.AreEqual("Boris", doc["Row2"]["STRING-2"].ToString());


            doc = rc.RowToBSONDocument(row, "NonExistent");
            Console.WriteLine(doc.ToString());
            Assert.AreEqual("Someone", doc["Row1"]["String2"].ToString());
            Assert.AreEqual("Boris", doc["Row2"]["String2"].ToString());
        }
Ejemplo n.º 2
0
        public void T_05_WithInnerRows()
        {
            var BYTES = new byte[] { 0x00, 0x79, 0x14 };

            var row = new RowB
            {
                Row1 = new RowA
                {
                    String1  = "Mudaker", String2 = null,
                    Date1    = new DateTime(1980, 07, 12), Date2 = null,
                    Bool1    = true, Bool2 = null,
                    Guid1    = new Guid("{9195F7DB-FE21-4BB2-B006-2496F4E24D14}"), Guid2 = null,
                    Gdid1    = new GDID(0, 12345), Gdid2 = null,
                    Float1   = 127.0123f, Float2 = null,
                    Double1  = 122345.012d, Double2 = null,
                    Decimal1 = 1234567.098M, Decimal2 = null,
                    Amount1  = new Amount("din", 123.11M), Amount2 = null,
                    Bytes1   = BYTES, Bytes2 = null
                },
                Row2 = new RowA
                {
                    String1  = "Abraham ILyach Lincoln", String2 = "I know that I know nothing",
                    Date1    = new DateTime(1877, 01, 02), Date2 = new DateTime(1977, 03, 15),
                    Bool1    = false, Bool2 = true,
                    Guid1    = new Guid("{AAAAAAAA-FE21-4BB2-B006-2496F4E24D14}"), Guid2 = null,
                    Gdid1    = new GDID(0, 12323423423), Gdid2 = new GDID(0, 187760098292476423),
                    Float1   = 127.0123f, Float2 = 123.2f,
                    Double1  = 122345.012d, Double2 = -18293f,
                    Decimal1 = 1234567.098M, Decimal2 = -2312m,
                    Amount1  = new Amount("usd", 89123M), Amount2 = new Amount("usd", 12398933.123m),
                    Bytes1   = null, Bytes2 = BYTES
                }
            };

            var rc = new RowConverter();

            var doc = rc.RowToBSONDocument(row, "A");

            Console.WriteLine(doc.ToString());

            var row2 = new RowB();

            rc.BSONDocumentToRow(doc, row2, "A");

            Assert.IsTrue(row.Equals(row2));
        }
Ejemplo n.º 3
0
        public void T_06_TargetingInnerRows()
        {
            var row = new RowB{
               Row1 = new RowA  { String1 = "Mudaker", String2 = "Someone"},
               Row2 = new RowA  { String1 = "Zar", String2 = "Boris"}
              };

              var rc = new RowConverter();

              var doc = rc.RowToBSONDocument( row, "A" );
              Console.WriteLine(doc.ToString());
              Assert.AreEqual( "Someone", doc["Row1"]["s2"].ToString());
              Assert.AreEqual( "Boris", doc["Row2"]["s2"].ToString());

              doc = rc.RowToBSONDocument( row, "B" );
              Console.WriteLine(doc.ToString());
              Assert.AreEqual( "Someone", doc["Row1"]["STRING-2"].ToString());
              Assert.AreEqual( "Boris", doc["Row2"]["STRING-2"].ToString());

              doc = rc.RowToBSONDocument( row, "NonExistent" );
              Console.WriteLine(doc.ToString());
              Assert.AreEqual( "Someone", doc["Row1"]["String2"].ToString());
              Assert.AreEqual( "Boris", doc["Row2"]["String2"].ToString());
        }
Ejemplo n.º 4
0
        public void T_05_WithInnerRows()
        {
            var BYTES = new byte[] {0x00, 0x79, 0x14};

              var row = new RowB
              {
            Row1 = new RowA
              {
            String1 = "Mudaker", String2 = null,
            Date1 = new DateTime(1980, 07, 12), Date2 = null,
            Bool1 = true, Bool2 = null,
            Guid1 = new Guid("{9195F7DB-FE21-4BB2-B006-2496F4E24D14}"), Guid2 = null,
            Gdid1 = new GDID(0, 12345), Gdid2 = null,
            Float1 = 127.0123f, Float2 = null,
            Double1 = 122345.012d, Double2 = null,
            Decimal1 = 1234567.098M, Decimal2 = null,
            Amount1 = new Amount("din", 123.11M), Amount2 = null,
            Bytes1 = BYTES, Bytes2 = null
              },
            Row2= new RowA
              {
            String1 = "Abraham ILyach Lincoln", String2 = "I know that I know nothing",
            Date1 = new DateTime(1877, 01, 02), Date2 = new DateTime(1977, 03, 15),
            Bool1 = false, Bool2 = true,
            Guid1 = new Guid("{AAAAAAAA-FE21-4BB2-B006-2496F4E24D14}"), Guid2 = null,
            Gdid1 = new GDID(0, 12323423423), Gdid2 =  new GDID(0, 187760098292476423),
            Float1 = 127.0123f, Float2 = 123.2f,
            Double1 = 122345.012d, Double2 = -18293f,
            Decimal1 = 1234567.098M, Decimal2 = -2312m,
            Amount1 = new Amount("usd", 89123M), Amount2 = new Amount("usd", 12398933.123m),
            Bytes1 = null, Bytes2 = BYTES
              }
              };

              var rc = new RowConverter();

              var doc = rc.RowToBSONDocument( row, "A" );

              Console.WriteLine(doc.ToString());

              var row2 = new RowB();
              rc.BSONDocumentToRow(doc, row2, "A");

              Assert.IsTrue( row.Equals( row2 ) );
        }