public void TestPostgreSqlNoPort() { String conn = new ConnectionStringPostgreSqlFactory().GetConnectionString("testserver", "testdb", "testusername", "testpassword", ""); Assert.AreEqual( "Server=testserver;Port=5432;Database=testdb;Userid=testusername;Password=testpassword;", conn, "ConnectionStringFactory not working for PostgreSql"); }
public void TestPostgreSqlNoDatabaseName() { try { String conn = new ConnectionStringPostgreSqlFactory().GetConnectionString("sdf", "", "sasdf", "testpassword", "testport"); Assert.Fail("Expected to throw an ArgumentException"); } //---------------Test Result ----------------------- catch (ArgumentException ex) { StringAssert.Contains("The server, database and userName of a connect string can never be empty", ex.Message); } }