public void TestFormattingWithUKPound()
 {
     BsonString str = new BsonString("1234£56");
     MemoryStream buf = new MemoryStream();
     BsonWriter writer = new BsonWriter(buf);
     str.Write(writer);
     writer.Flush();
     Byte[] output = buf.ToArray();
     String hexdump = BitConverter.ToString(output);
     hexdump = hexdump.Replace("-","");
     Assert.AreEqual("0900000031323334C2A3353600",hexdump, "Dump not correct");
     Assert.AreEqual(9,output[0],"Size didn't take into account size of pound symbol");
 }
Example #2
0
        public void TestBsonString()
        {
            InitStreams();
            BsonString w = new BsonString("test");
            w.Write(writer);

            FlushAndGotoBegin();

            BsonString r = new BsonString();
            r.Read(reader);

            Assert.AreEqual(w.Val, r.Val);
        }
 public void TestFormatting()
 {
     BsonString str = new BsonString("test");
     MemoryStream buf = new MemoryStream();
     BsonWriter writer = new BsonWriter(buf);
     str.Write(writer);
     writer.Flush();
     Byte[] output = buf.ToArray();
     String hexdump = BitConverter.ToString(output);
     hexdump = hexdump.Replace("-","");
     Assert.AreEqual(5,output[0],"Size didn't take into count null terminator");
     Assert.AreEqual("050000007465737400",hexdump, "Dump not correct");
 }