Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
If a null secretName is given, a KeyNotFoundException is thrown instead of an InvalidOperationException.

Related to: #300
  • Loading branch information
sikutisa committed Sep 11, 2024
1 parent c7f34e6 commit 4ba8666
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public void Given_NullOrEmpty_VaultUri_When_Invoked_AddKeyVaultService_Then_It_S
}

[Theory]
[InlineData("http://localhost", default(string))]
[InlineData("http://localhost", "")]
public void Given_NullOrEmpty_SecretName_When_Invoked_AddKeyVaultService_Then_It_Should_Throw_Exception(string vaultUri, string? secretName)
[InlineData("http://localhost", default(string), typeof(KeyNotFoundException))]
[InlineData("http://localhost", "", typeof(InvalidOperationException))]
public void Given_NullOrEmpty_SecretName_When_Invoked_AddKeyVaultService_Then_It_Should_Throw_Exception(string vaultUri, string? secretName, Type exceptionType)
{
// Arrange
var services = new ServiceCollection();
Expand All @@ -129,7 +129,7 @@ public void Given_NullOrEmpty_SecretName_When_Invoked_AddKeyVaultService_Then_It
Action action = () => services.BuildServiceProvider().GetService<SecretClient>();

// Assert
action.Should().Throw<InvalidOperationException>();
action.Should().Throw<Exception>().Which.Should().BeOfType(exceptionType);
}

[Theory]
Expand Down

0 comments on commit 4ba8666

Please sign in to comment.