コード例 #1
0
 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");
 }
コード例 #2
0
ファイル: TestBsonTypes.cs プロジェクト: sbos/mongodb-csharp
        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);
        }
コード例 #3
0
 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");
 }