WriteInt64() публичный Метод

Writes a BSON Int64 to the writer.
public WriteInt64 ( long value ) : void
value long The Int64 value.
Результат void
Пример #1
0
 public void TestTwoInt64s()
 {
     var document = new BsonDocument();
     using (var writer = new BsonDocumentWriter(document))
     {
         writer.WriteStartDocument();
         writer.WriteInt64("a", 1);
         writer.WriteInt64("b", 2);
         writer.WriteEndDocument();
     }
     var json = document.ToJson();
     var expected = "{ 'a' : NumberLong(1), 'b' : NumberLong(2) }".Replace("'", "\""); ;
     Assert.Equal(expected, json);
 }
Пример #2
0
 public void TestOneNestedInt64()
 {
     var document = new BsonDocument();
     using (var writer = new BsonDocumentWriter(document))
     {
         writer.WriteStartDocument();
         writer.WriteStartDocument("nested");
         writer.WriteInt64("a", 1);
         writer.WriteEndDocument();
         writer.WriteEndDocument();
     }
     var json = document.ToJson();
     var expected = "{ 'nested' : { 'a' : NumberLong(1) } }".Replace("'", "\"");
     Assert.Equal(expected, json);
 }