Skip to content

Commit bec6844

Browse files
committed
Added unit tests for issue #111
1 parent 0e98844 commit bec6844

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

tests/Binder/AppSettings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public class AppSettings
1616
private string IgnoredProperty { get; set; }
1717
}
1818

19+
public class SettingsExample0
20+
{
21+
public string RealKey { get; set; }
22+
}
23+
1924
public class SettingsExample1
2025
{
2126
public string SecretKey { get; set; }

tests/Binder/EnvBinderTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ namespace DotEnv.Core.Tests.Binder;
33
[TestClass]
44
public class EnvBinderTests
55
{
6+
[TestMethod]
7+
public void Bind_WhenPropertyNameDoesNotMatchRealKey_ShouldReturnSettingsInstance()
8+
{
9+
SetEnvironmentVariable("REAL_KEY", "1234D");
10+
11+
var settings = new EnvBinder().Bind<SettingsExample0>();
12+
13+
Assert.AreEqual(expected: "1234D", actual: settings.RealKey);
14+
}
15+
616
[TestMethod]
717
public void Bind_WhenPropertiesAreLinkedToTheDefaultProviderInstance_ShouldReturnSettingsInstance()
818
{

0 commit comments

Comments
 (0)