public void TestVariableResolutionFromApplicationSettingsSchema() { ConfigSectionVariableSource vs = new ConfigSectionVariableSource(); vs.SectionName = "applicationSettings/MyApp.Properties.Settings"; Assert.AreEqual("1000", vs.ResolveVariable("maxResults")); Assert.AreEqual(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb;User ID=Admin;Password=;", vs.ResolveVariable("connection.string")); }
public void TestVariablesResolutionWithSingleSection() { ConfigSectionVariableSource vs = new ConfigSectionVariableSource(); vs.SectionName = "DaoConfiguration"; // existing vars Assert.AreEqual("1000", vs.ResolveVariable("maxResults")); Assert.AreEqual("1000", vs.ResolveVariable("MAXResults")); // non-existant variable Assert.IsNull(vs.ResolveVariable("dummy")); }
public void TestVariablesResolutionWithTwoSections() { ConfigSectionVariableSource vs = new ConfigSectionVariableSource(); vs.SectionNames = new string[] { "DaoConfiguration", "DatabaseConfiguration" }; // existing vars Assert.AreEqual("1000", vs.ResolveVariable("maxResults")); Assert.AreEqual("1000", vs.ResolveVariable("MAXResults")); Assert.AreEqual(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb;User ID=Admin;Password=;", vs.ResolveVariable("connection.string")); Assert.AreEqual(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\Northwind.mdb;User ID=Admin;Password=;", vs.ResolveVariable("Connection.String")); // non-existant variable Assert.IsNull(vs.ResolveVariable("dummy")); }