@@ -61,38 +61,37 @@ public void Constructor_throws_on_invalid_arguments(
61
61
IReadOnlyList < EndPoint > endPoints ,
62
62
string principalName ,
63
63
IReadOnlyDictionary < string , object > mechanismProperties ,
64
- string paramName )
64
+ Type exceptionType )
65
65
{
66
66
var exception = Record . Exception ( ( ) =>
67
67
new OidcConfiguration ( endPoints , principalName , mechanismProperties ) ) ;
68
68
69
- exception . Should ( ) . BeAssignableTo < ArgumentException > ( )
70
- . Subject . ParamName . Should ( ) . Be ( paramName ) ;
69
+ exception . Should ( ) . BeOfType ( exceptionType ) ;
71
70
}
72
71
73
72
public static IEnumerable < object [ ] > InvalidConfigurationTestCases = new [ ]
74
73
{
75
- new object [ ] { null , null , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "test" } , "endPoints" } ,
76
- new object [ ] { Array . Empty < EndPoint > ( ) , null , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "test" } , "endPoints" } ,
77
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , null , null , "authMechanismProperties" } ,
78
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , null , "authMechanismProperties" } ,
79
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , null , new Dictionary < string , object > ( ) , null } ,
80
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > ( ) , null } ,
81
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "unknown_property" ] = 42 } , "unknown_property" } ,
82
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = null } , "ENVIRONMENT" } ,
83
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "" } , "ENVIRONMENT" } ,
84
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = 1 } , "ENVIRONMENT" } ,
85
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "unknown provider" } , "ENVIRONMENT" } ,
86
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "OIDC_CALLBACK" ] = null } , "OIDC_CALLBACK" } ,
87
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "OIDC_CALLBACK" ] = "invalid type" } , "OIDC_CALLBACK" } ,
88
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "OIDC_CALLBACK" ] = __callbackMock , [ "ENVIRONMENT" ] = "test" } , null } ,
89
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "test" , [ "TOKEN_RESOURCE" ] = "tr" } , "TOKEN_RESOURCE" } ,
90
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "azure" } , "TOKEN_RESOURCE" } ,
91
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "azure" , [ "TOKEN_RESOURCE" ] = null } , "TOKEN_RESOURCE" } ,
92
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "azure" , [ "TOKEN_RESOURCE" ] = "" } , "TOKEN_RESOURCE" } ,
93
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "gcp" } , "TOKEN_RESOURCE" } ,
94
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "gcp" , [ "TOKEN_RESOURCE" ] = null } , "TOKEN_RESOURCE" } ,
95
- new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "gcp" , [ "TOKEN_RESOURCE" ] = "" } , "TOKEN_RESOURCE" } ,
74
+ new object [ ] { null , null , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "test" } , typeof ( ArgumentNullException ) } ,
75
+ new object [ ] { Array . Empty < EndPoint > ( ) , null , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "test" } , typeof ( ArgumentException ) } ,
76
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , null , null , typeof ( ArgumentNullException ) } ,
77
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , null , typeof ( ArgumentNullException ) } ,
78
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , null , new Dictionary < string , object > ( ) , typeof ( MongoConfigurationException ) } ,
79
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > ( ) , typeof ( MongoConfigurationException ) } ,
80
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "unknown_property" ] = 42 } , typeof ( MongoConfigurationException ) } ,
81
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = null } , typeof ( MongoConfigurationException ) } ,
82
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "" } , typeof ( MongoConfigurationException ) } ,
83
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = 1 } , typeof ( MongoConfigurationException ) } ,
84
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "unknown provider" } , typeof ( MongoConfigurationException ) } ,
85
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "OIDC_CALLBACK" ] = null } , typeof ( MongoConfigurationException ) } ,
86
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "OIDC_CALLBACK" ] = "invalid type" } , typeof ( MongoConfigurationException ) } ,
87
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "OIDC_CALLBACK" ] = __callbackMock , [ "ENVIRONMENT" ] = "test" } , typeof ( MongoConfigurationException ) } ,
88
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "test" , [ "TOKEN_RESOURCE" ] = "tr" } , typeof ( MongoConfigurationException ) } ,
89
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "azure" } , typeof ( MongoConfigurationException ) } ,
90
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "azure" , [ "TOKEN_RESOURCE" ] = null } , typeof ( MongoConfigurationException ) } ,
91
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "azure" , [ "TOKEN_RESOURCE" ] = "" } , typeof ( MongoConfigurationException ) } ,
92
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "gcp" } , typeof ( MongoConfigurationException ) } ,
93
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "gcp" , [ "TOKEN_RESOURCE" ] = null } , typeof ( MongoConfigurationException ) } ,
94
+ new object [ ] { new [ ] { new DnsEndPoint ( "localhost" , 27017 ) } , "name" , new Dictionary < string , object > { [ "ENVIRONMENT" ] = "gcp" , [ "TOKEN_RESOURCE" ] = "" } , typeof ( MongoConfigurationException ) } ,
96
95
} ;
97
96
98
97
[ Theory ]
0 commit comments