public void TestHP()
 {
     string urlString = "mongodb://mongo.xyz.com:12345";
     MongoUrl url = new MongoUrl(urlString);
     Assert.AreEqual(1, url.SeedList.Count());
     Assert.AreEqual("mongo.xyz.com", url.SeedList.Single().Host);
     Assert.AreEqual(12345, url.SeedList.Single().Port);
     Assert.IsNull(url.DatabaseName);
     Assert.IsNull(url.Username);
     Assert.IsNull(url.Password);
     Assert.AreEqual(urlString, url.ToString());
 }
 public void TestH1P1H2P2()
 {
     string urlString = "mongodb://mongo1.xyz.com:12345,mongo2.xyz.com:23456";
     MongoUrl url = new MongoUrl(urlString);
     Assert.AreEqual(2, url.SeedList.Count());
     Assert.AreEqual("mongo1.xyz.com", url.SeedList.First().Host);
     Assert.AreEqual(12345, url.SeedList.First().Port);
     Assert.AreEqual("mongo2.xyz.com", url.SeedList.Skip(1).Single().Host);
     Assert.AreEqual(23456, url.SeedList.Skip(1).Single().Port);
     Assert.IsNull(url.DatabaseName);
     Assert.IsNull(url.Username);
     Assert.IsNull(url.Password);
     Assert.AreEqual(urlString, url.ToString());
 }
 public void TestL()
 {
     string urlString = "mongodb://localhost";
     MongoUrl url = new MongoUrl(urlString);
     Assert.AreEqual(1, url.SeedList.Count());
     Assert.AreEqual("localhost", url.SeedList.Single().Host);
     Assert.AreEqual(27017, url.SeedList.Single().Port);
     Assert.IsNull(url.DatabaseName);
     Assert.IsNull(url.Username);
     Assert.IsNull(url.Password);
     Assert.AreEqual(urlString, url.ToString());
 }
 public void TestUPLD()
 {
     string urlString = "mongodb://*****:*****@localhost/dbname";
     MongoUrl url = new MongoUrl(urlString);
     Assert.AreEqual(1, url.SeedList.Count());
     Assert.AreEqual("localhost", url.SeedList.Single().Host);
     Assert.AreEqual(27017, url.SeedList.Single().Port);
     Assert.AreEqual("dbname", url.DatabaseName);
     Assert.AreEqual("userx", url.Username);
     Assert.AreEqual("pwd", url.Password);
     Assert.AreEqual(urlString, url.ToString());
 }
 public void TestUPH1H2D()
 {
     string urlString = "mongodb://*****:*****@mongo1.xyz.com,mongo2.xyz.com/dbname";
     MongoUrl url = new MongoUrl(urlString);
     Assert.AreEqual(2, url.SeedList.Count());
     Assert.AreEqual("mongo1.xyz.com", url.SeedList.First().Host);
     Assert.AreEqual(27017, url.SeedList.First().Port);
     Assert.AreEqual("mongo2.xyz.com", url.SeedList.Skip(1).Single().Host);
     Assert.AreEqual(27017, url.SeedList.Skip(1).Single().Port);
     Assert.AreEqual("dbname", url.DatabaseName);
     Assert.AreEqual("userx", url.Username);
     Assert.AreEqual("pwd", url.Password);
     Assert.AreEqual(urlString, url.ToString());
 }