The ConnectionStrings property of System.Configuration.ConfigurationManager
works perfectly, so this MonoTODO is not needed.
A unit test is also added to demonstrate that it's fully working and to
prevent it failing in the future.
}
}
- [MonoTODO]
public static ConnectionStringSettingsCollection ConnectionStrings {
get {
ConnectionStringsSection connectionStrings = (ConnectionStringsSection) GetSection ("connectionStrings");
--- /dev/null
+Test/App.config
\ No newline at end of file
--- /dev/null
+Test/App.config
\ No newline at end of file
--- /dev/null
+Test/App.config
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<configuration>
+ <connectionStrings>
+ <add name="test-connstring"
+ connectionString="Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;" />
+ </connectionStrings>
+</configuration>
Assert.That (EvaluationContext != null, label);
}
}
+
+
+ [Test]
+ public void TestConnectionStringRetrieval ()
+ {
+ var connStringObj = ConfigurationManager.ConnectionStrings ["test-connstring"];
+ Assert.IsNotNull (connStringObj);
+ var connString = connStringObj.ConnectionString;
+ Assert.IsFalse (String.IsNullOrEmpty (connString));
+ Assert.AreEqual ("Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;",
+ connString);
+ }
}
}