I have an integration test using XUnit that accesses the database. We need to be able to get the database connection string from the app.config file.
When running the test from the IDE it works beautifully and the connection string is found. When I run the test automatically from a cake.build the ConfigurationManager.ConnectionStrings["blahblah"] ret
var connectionStringSettings = ConfigurationManager.ConnectionStrings["FlexConnString"];
if (connectionStringSettings == null)
{
Console.WriteLine("ConfigManager does not return a setting for FlexConnString");
_connectionString = "No Connection string";
}
The Cake Task is
Task("Run-Integration-Tests")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
var testDir = "./artifacts/_tests/**/*.IntegrationTests.dll";
Information("Start Running Integration Tests in " + testDir);
XUnit2(testDir,
new XUnit2Settings {
Parallelism = ParallelismOption.All,
HtmlReport = true,
NoAppDomain = true,
NUnitReport = true,
XmlReport = true,
ReportName = "MixTdiIntegrationTestResults",
OutputDirectory = "./artifacts"
});
});
This outputs ConfigManager does not return a setting for FlexConnString' when running the build.cake from powershell.
I'm not sure if this is an XUnit issue or a Cake issue.