Skip to content

Commit

Permalink
red: add LocalConfigurationFeature.ConfigurationFileIsNull
Browse files Browse the repository at this point in the history
  • Loading branch information
adamralph committed May 21, 2016
1 parent f2af59a commit a537c6d
Showing 1 changed file with 18 additions and 0 deletions.
Expand Up @@ -5,6 +5,7 @@
namespace ConfigR.Tests.Acceptance.Roslyn.CSharp
{
using System;
using System.IO;
using ConfigR.Tests.Acceptance.Roslyn.CSharp.Support;
using FluentAssertions;
using Xbehave;
Expand Down Expand Up @@ -69,5 +70,22 @@ public static void ScriptFailsToExecute(Exception exception)
"And the exception message is 'Boo!'"
.f(() => exception.Message.Should().Be("Boo!"));
}

[Scenario]
public static void ConfigurationFileIsNull(Exception exception)
{
"Given the app domain configuration file is null"
.f(c => AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", null))
.Teardown(() => AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", Path.GetFileName(ConfigFile.GetDefaultPath())));

"When I load the config file"
.f(async () => exception = await Record.ExceptionAsync(async () => await new Config().UseRoslynCSharpLoader().Load()));

"Then an invalid operation exception is thrown"
.f(() => exception.Should().NotBeNull());

"And the exception message tells us that the app domain config file is null"
.f(() => exception.Message.Should().Be("AppDomain.CurrentDomain.SetupInformation.ConfigurationFile is null."));
}
}
}

0 comments on commit a537c6d

Please sign in to comment.