Skip to content

Commit

Permalink
test: Add tests when the path collection is empty (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDave1999 committed Jun 27, 2024
1 parent e468736 commit 69beb36
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ public void AddDotEnv_WhenCustomConfigurationIsUsed_ShouldReadKeyValuePairs()
reader[Summaries].Should().Be(Expected);
}

[TestMethod]
public void AddDotEnv_WhenPathCollectionIsEmpty_ShouldThrowArgumentException()
{
// Arrange
var services = new ServiceCollection();
string[] paths = [];

// Act
Action act = () => services.AddDotEnv(paths);

// Assert
act.Should()
.Throw<ArgumentException>()
.WithParameterName(nameof(paths));
}

[TestMethod]
public void AddDotEnvOfT_WhenDefaultEnvFileNameIsUsed_ShouldReadKeyValuePairs()
{
Expand Down Expand Up @@ -71,6 +87,22 @@ public void AddDotEnvOfT_WhenCustomConfigurationIsUsed_ShouldReadKeyValuePairs()
settings.Summaries.Should().Be(Expected);
}

[TestMethod]
public void AddDotEnvOfT_WhenPathCollectionIsEmpty_ShouldThrowArgumentException()
{
// Arrange
var services = new ServiceCollection();
string[] paths = [];

// Act
Action act = () => services.AddDotEnv<AppSettings>(paths);

// Assert
act.Should()
.Throw<ArgumentException>()
.WithParameterName(nameof(paths));
}

[TestMethod]
public void AddCustomEnv_WhenCustomConfigurationIsUsed_ShouldReadKeyValuePairs()
{
Expand Down

0 comments on commit 69beb36

Please sign in to comment.