Inheritance: ConnectionManagerBase
 public void DatabaseNameTest()
 {
     MongoConnectionManager target = new MongoConnectionManager();
     string expected = "db1";
     string actual = null;
     target.DatabaseName = expected;
     actual = target.DatabaseName;
     Assert.AreEqual(expected, actual);
 }
 public void PasswordTest()
 {
     MongoConnectionManager target = new MongoConnectionManager();
     string expected = "pwd123";
     string actual = null;
     target.Password = expected;
     actual = target.Password;
     Assert.AreEqual(expected, actual);
 }
    public void ConnectionStringTest()
    {
        MongoConnectionManager target = new MongoConnectionManager();
        string user = "******";
        string pwd = "pwd1";
        string server = "server1";

        string actual = null;
        target.UserName = user;
        target.Password = pwd;
        target.ServerName = server;
        actual = target.ConnectionString;
        Assert.AreEqual("mongodb://" + user + ":" + pwd + "@" + server, actual);
    }
    public void ReleaseConnectionTest()
    {
        MongoConnectionManager target = new MongoConnectionManager();

        MongoServer server = Mock.Create<MongoServer>(Constructor.Mocked);

        MongoDatabaseSettings dbSettings = Mock.Create<MongoDatabaseSettings>(Constructor.Mocked);
        MongoDatabase connection = Mock.Create<MongoDatabase>(Constructor.Mocked);

        Mock.Arrange(() => connection.Server).Returns(server);

        target.ReleaseConnection(connection);

        Mock.Assert(() => server.Disconnect());
    }
 public void ValidateReturnsSuccessIfUserNameEmptyTest()
 {
     MongoConnectionManager target = new MongoConnectionManager();
     target.ServerName = "server123";
     target.DatabaseName = "db123";
     target.UserName = "";
     target.Password = "******";
     IDTSInfoEvents infoEvents = null;
             DTSExecResult expected = DTSExecResult.Success;
     DTSExecResult actual = default(DTSExecResult);
     actual = target.Validate(infoEvents);
     Assert.AreEqual(expected, actual);
 }
 public void UserNameTest()
 {
     MongoConnectionManager target = new MongoConnectionManager();
     string expected = "user123";
     string actual = null;
     target.UserName = expected;
     actual = target.UserName;
     Assert.AreEqual(expected, actual);
 }
 public void ServerNameIsLocalhostByDefaultTest()
 {
     MongoConnectionManager target = new MongoConnectionManager();
     string actual = null;
     actual = target.ServerName;
     Assert.AreEqual("localhost", actual);
 }
 public void UpdateTest()
 {
     MongoConnectionManager target = new MongoConnectionManager();
     string ObjectXml = "<ConnectionManager><ObjectData><InnerObject><SlaveOk Type=\"11\" Value=\"-1\" /></InnerObject></ObjectData></ConnectionManager>";
     string ObjectXmlExpected = "<ConnectionManager><ObjectData><InnerObject><SlaveOk Type=\"11\" Value=\"-1\" /><Ssl Type=\"11\" Value=\"0\" /></InnerObject></ObjectData></ConnectionManager>";
     target.Update(ref ObjectXml);
     Assert.AreEqual(XDocument.Parse(ObjectXmlExpected).ToString(), ObjectXml);
 }
 public void SslTest()
 {
     MongoConnectionManager target = new MongoConnectionManager();
     bool expected = true;
     target.Ssl = expected;
     bool actual = target.Ssl;
     Assert.AreEqual(expected, actual);
 }
 public void SslDefaultFalseTest()
 {
     MongoConnectionManager target = new MongoConnectionManager();
     bool expected = false;
     bool actual = target.Ssl;
     Assert.AreEqual(expected, actual);
 }