Skip to content

Commit 983c0dc

Browse files
committed
Add test
1 parent 70e2005 commit 983c0dc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace Xunit.Microsoft.DependencyInjection.ExampleTests;
2+
3+
public class ConfigurationTests : TestBed<TestProjectFixture>
4+
{
5+
private const string Key = "CONFIG_KEY";
6+
private const string Value = "Value";
7+
8+
public ConfigurationTests(ITestOutputHelper testOutputHelper, TestProjectFixture fixture) : base(testOutputHelper, fixture)
9+
{
10+
Environment.SetEnvironmentVariable(Key, Value);
11+
}
12+
13+
[Fact]
14+
public void EnvironmentVariablesViaConstructorAreAvailable()
15+
{
16+
_fixture.GetServiceProvider(_testOutputHelper);
17+
18+
var value = _fixture.Configuration!.GetValue<string>(Key);
19+
20+
Assert.Equal(Value, value);
21+
}
22+
}

0 commit comments

Comments
 (0)