@@ -92,7 +92,7 @@ public void Given_NullOrEmpty_VaultUri_When_Invoked_AddKeyVaultService_Then_It_S
92
92
var dict = new Dictionary < string , string > ( )
93
93
{
94
94
{ "Azure:KeyVault:VaultUri" , vaultUri ! } ,
95
- { "Azure:KeyVault:SecretName " , secretName } ,
95
+ { "Azure:KeyVault:SecretNames:OpenAI " , secretName } ,
96
96
} ;
97
97
#pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.
98
98
var config = new ConfigurationBuilder ( ) . AddInMemoryCollection ( dict ) . Build ( ) ;
@@ -108,16 +108,16 @@ public void Given_NullOrEmpty_VaultUri_When_Invoked_AddKeyVaultService_Then_It_S
108
108
}
109
109
110
110
[ Theory ]
111
- [ InlineData ( "http://localhost" , default ( string ) ) ]
112
- [ InlineData ( "http://localhost" , "" ) ]
113
- public void Given_NullOrEmpty_SecretName_When_Invoked_AddKeyVaultService_Then_It_Should_Throw_Exception ( string vaultUri , string ? secretName )
111
+ [ InlineData ( "http://localhost" , default ( string ) , typeof ( KeyNotFoundException ) ) ]
112
+ [ InlineData ( "http://localhost" , "" , typeof ( InvalidOperationException ) ) ]
113
+ public void Given_NullOrEmpty_SecretName_When_Invoked_AddKeyVaultService_Then_It_Should_Throw_Exception ( string vaultUri , string ? secretName , Type exceptionType )
114
114
{
115
115
// Arrange
116
116
var services = new ServiceCollection ( ) ;
117
117
var dict = new Dictionary < string , string > ( )
118
118
{
119
119
{ "Azure:KeyVault:VaultUri" , vaultUri } ,
120
- { "Azure:KeyVault:SecretName " , secretName ! } ,
120
+ { "Azure:KeyVault:SecretNames:OpenAI " , secretName ! } ,
121
121
} ;
122
122
#pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.
123
123
var config = new ConfigurationBuilder ( ) . AddInMemoryCollection ( dict ) . Build ( ) ;
@@ -129,7 +129,7 @@ public void Given_NullOrEmpty_SecretName_When_Invoked_AddKeyVaultService_Then_It
129
129
Action action = ( ) => services . BuildServiceProvider ( ) . GetService < SecretClient > ( ) ;
130
130
131
131
// Assert
132
- action . Should ( ) . Throw < InvalidOperationException > ( ) ;
132
+ action . Should ( ) . Throw < Exception > ( ) . Which . Should ( ) . BeOfType ( exceptionType ) ;
133
133
}
134
134
135
135
[ Theory ]
@@ -141,7 +141,7 @@ public void Given_Invalid_VaultUri_When_Invoked_AddKeyVaultService_Then_It_Shoul
141
141
var dict = new Dictionary < string , string > ( )
142
142
{
143
143
{ "Azure:KeyVault:VaultUri" , vaultUri } ,
144
- { "Azure:KeyVault:SecretName " , secretName } ,
144
+ { "Azure:KeyVault:SecretNames:OpenAI " , secretName } ,
145
145
} ;
146
146
#pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.
147
147
var config = new ConfigurationBuilder ( ) . AddInMemoryCollection ( dict ) . Build ( ) ;
@@ -165,7 +165,7 @@ public void Given_AppSettings_When_Invoked_AddKeyVaultService_Then_It_Should_Ret
165
165
var dict = new Dictionary < string , string > ( )
166
166
{
167
167
{ "Azure:KeyVault:VaultUri" , vaultUri } ,
168
- { "Azure:KeyVault:SecretName " , secretName } ,
168
+ { "Azure:KeyVault:SecretNames:OpenAI " , secretName } ,
169
169
} ;
170
170
#pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.
171
171
var config = new ConfigurationBuilder ( ) . AddInMemoryCollection ( dict ) . Build ( ) ;
@@ -190,7 +190,7 @@ public void Given_AppSettings_When_Invoked_AddKeyVaultService_Then_It_Should_Ret
190
190
var dict = new Dictionary < string , string > ( )
191
191
{
192
192
{ "Azure:KeyVault:VaultUri" , vaultUri } ,
193
- { "Azure:KeyVault:SecretName " , secretName } ,
193
+ { "Azure:KeyVault:SecretNames:OpenAI " , secretName } ,
194
194
} ;
195
195
#pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types.
196
196
var config = new ConfigurationBuilder ( ) . AddInMemoryCollection ( dict ) . Build ( ) ;
0 commit comments