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

Initializes an existing instance of the CommandResult class.
public Initialize ( IMongoCommand command, BsonDocument response ) : void
command IMongoCommand The command.
response BsonDocument The response.
Результат void
 public void TestErrorMessagePresent()
 {
     var document = new BsonDocument("errmsg", "An error message");
     var result = new CommandResult();
     result.Initialize(document);
     Assert.AreEqual("An error message", result.ErrorMessage);
 }
 public void TestErrorMessageNotString()
 {
     var document = new BsonDocument("errmsg", 3.14159);
     var result = new CommandResult();
     result.Initialize(document);
     Assert.AreEqual("3.14159", result.ErrorMessage);
 }
 public void TestErrorMessageMissing()
 {
     var document = new BsonDocument();
     var result = new CommandResult();
     result.Initialize(document);
     Assert.AreEqual("Unknown error", result.ErrorMessage);
 }
 public void TestOkFalse()
 {
     var document = new BsonDocument("ok", false);
     var result = new CommandResult();
     result.Initialize(document);
     Assert.IsFalse(result.Ok);
     Assert.IsNotNull(result.ErrorMessage);
 }
 public void TestOkOnePointZero()
 {
     var document = new BsonDocument("ok", 1.0);
     var result = new CommandResult();
     result.Initialize(document);
     Assert.IsTrue(result.Ok);
     Assert.IsNull(result.ErrorMessage);
 }
 public void TestOkMissing()
 {
     var document = new BsonDocument();
     var result = new CommandResult();
     result.Initialize(document);
     Assert.Throws<MongoCommandException>(() => { var dummy = result.Ok; });
 }