public void TestMultiServersGetConnectionString()
        {
            MongoConfiguration config = new MongoConfiguration { Username = string.Empty, Password = string.Empty };

            config.Host = "127.0.0.1";
            config.Port = 22;
            config.Database = "Test";
            Assert.AreEqual("mongodb://127.0.0.1:22/Test", config.ToConnectionString());

            config.Username = "******";
            config.Password = "******";
            Assert.AreEqual("mongodb://*****:*****@127.0.0.1:22/Test", config.ToConnectionString());

            config.Servers = new Server[1];
            config.Servers[0] = new Server() { Host = "localhost", Port = 1000 };
            Assert.AreEqual("mongodb://*****:*****@localhost:1000/Test", config.ToConnectionString());

            config.Servers = new Server[2];
            config.Servers[0] = new Server() { Host = "localhost", Port = 1000 };
            config.Servers[1] = new Server() { Host = "100.10.1.1", Port = 5000 };
            Assert.AreEqual("mongodb://*****:*****@localhost:1000,100.10.1.1:5000/Test", config.ToConnectionString());

            config.ReplicaSet = "iApplyReplicaSet";
            Assert.AreEqual("mongodb://*****:*****@localhost:1000,100.10.1.1:5000/Test?replicaSet=iApplyReplicaSet", config.ToConnectionString());

            config.ReplicaSet = string.Empty;
            config.Username = string.Empty;
            Assert.AreEqual("mongodb://localhost:1000,100.10.1.1:5000/Test", config.ToConnectionString());
        }
        public void TestGetConnectionString()
        {
            MongoConfiguration config = new MongoConfiguration { Username = string.Empty, Password = string.Empty };

            Assert.IsFalse(config.ToConnectionString().Contains("@"));

            config.Username = "******";
            config.Password = "******";

            Assert.IsTrue(config.ToConnectionString().Contains(config.Username));
            Assert.IsTrue(config.ToConnectionString().Contains("@"));
            Assert.IsTrue(config.ToConnectionString().Contains(config.Password));
        }