@@ -68,6 +68,39 @@ public void ReadCertificatesSection_ReturnsCollection()
68
68
Assert . True ( storeCert . AllowInvalid ) ;
69
69
}
70
70
71
+ [ Fact ]
72
+ public void ReadCertificatesSection_IsCaseInsensitive ( )
73
+ {
74
+ var config = new ConfigurationBuilder ( ) . AddInMemoryCollection ( new [ ]
75
+ {
76
+ new KeyValuePair < string , string > ( "Certificates:filecert:Path" , "/path/cert.pfx" ) ,
77
+ new KeyValuePair < string , string > ( "Certificates:FILECERT:Password" , "certpassword" ) ,
78
+ } ) . Build ( ) ;
79
+ var reader = new ConfigurationReader ( config ) ;
80
+ var certificates = reader . Certificates ;
81
+ Assert . NotNull ( certificates ) ;
82
+ Assert . Equal ( 1 , certificates . Count ) ;
83
+
84
+ var fileCert = certificates [ "FiLeCeRt" ] ;
85
+ Assert . True ( fileCert . IsFileCert ) ;
86
+ Assert . False ( fileCert . IsStoreCert ) ;
87
+ Assert . Equal ( "/path/cert.pfx" , fileCert . Path ) ;
88
+ Assert . Equal ( "certpassword" , fileCert . Password ) ;
89
+ }
90
+
91
+ [ Fact ]
92
+ public void ReadCertificatesSection_ThrowsOnCaseInsensitiveDuplicate ( )
93
+ {
94
+ var exception = Assert . Throws < ArgumentException > ( ( ) =>
95
+ new ConfigurationBuilder ( ) . AddInMemoryCollection ( new [ ]
96
+ {
97
+ new KeyValuePair < string , string > ( "Certificates:filecert:Password" , "certpassword" ) ,
98
+ new KeyValuePair < string , string > ( "Certificates:FILECERT:Password" , "certpassword" ) ,
99
+ } ) . Build ( ) ) ;
100
+
101
+ Assert . Contains ( "An item with the same key has already been added" , exception . Message ) ;
102
+ }
103
+
71
104
[ Fact ]
72
105
public void ReadEndpointsWhenNoEndpointsSection_ReturnsEmptyCollection ( )
73
106
{
0 commit comments