@@ -26,7 +26,7 @@ public void WithAuthentication_UsernamePassword()
2626
2727 Assert . Equal ( Username , authenticationInfo . Username ) ;
2828 Assert . Equal ( Password , authenticationInfo . Password ) ;
29- Assert . Null ( authenticationInfo . IamCredentials ) ;
29+ Assert . False ( authenticationInfo . HasIamCredentials ) ;
3030
3131 // Password cannot be null.
3232 Assert . Throws < ArgumentNullException > ( ( ) => builder . WithAuthentication ( Username , ( string ) null ! ) ) ;
@@ -43,7 +43,7 @@ public void WithAuthentication_PasswordOnly()
4343
4444 Assert . Null ( authenticationInfo . Username ) ;
4545 Assert . Equal ( Password , authenticationInfo . Password ) ;
46- Assert . Null ( authenticationInfo . IamCredentials ) ;
46+ Assert . False ( authenticationInfo . HasIamCredentials ) ;
4747
4848 // Password cannot be null.
4949 Assert . Throws < ArgumentNullException > ( ( ) => builder . WithAuthentication ( null ! ) ) ;
@@ -58,13 +58,16 @@ public void WithAuthentication_UsernameIamAuthConfig_ConfiguresCorrectly()
5858
5959 var config = builder . Build ( ) ;
6060 var authenticationInfo = config ! . Request . AuthenticationInfo ! . Value ;
61- var iamCredentials = authenticationInfo . IamCredentials ! . Value ;
6261
6362 Assert . Equal ( Username , authenticationInfo . Username ) ;
6463 Assert . Null ( authenticationInfo . Password ) ;
64+ Assert . True ( authenticationInfo . HasIamCredentials ) ;
65+
66+ var iamCredentials = authenticationInfo . IamCredentials ! ;
6567 Assert . Equal ( ClusterName , iamCredentials . ClusterName ) ;
6668 Assert . Equal ( Region , iamCredentials . Region ) ;
6769 Assert . Equal ( FFI . ServiceType . ElastiCache , iamCredentials . ServiceType ) ;
70+ Assert . True ( iamCredentials . HasRefreshIntervalSeconds ) ;
6871 Assert . Equal ( 600u , iamCredentials . RefreshIntervalSeconds ) ;
6972
7073 // Username and IamAuthConfig cannot be null.
@@ -86,7 +89,7 @@ public void WithAuthentication_MultipleCalls_LastWins()
8689
8790 Assert . Equal ( Username , authenticationInfo . Username ) ;
8891 Assert . Equal ( Password , authenticationInfo . Password ) ;
89- Assert . Null ( authenticationInfo . IamCredentials ) ;
92+ Assert . False ( authenticationInfo . HasIamCredentials ) ;
9093
9194 // IAM authentication last.
9295 builder = new StandaloneClientConfigurationBuilder ( ) ;
@@ -95,14 +98,16 @@ public void WithAuthentication_MultipleCalls_LastWins()
9598
9699 config = builder . Build ( ) ;
97100 authenticationInfo = config ! . Request . AuthenticationInfo ! . Value ;
98- var iamCredentials = authenticationInfo . IamCredentials ! . Value ;
99101
100102 Assert . Equal ( Username , authenticationInfo . Username ) ;
101103 Assert . Null ( authenticationInfo . Password ) ;
104+ Assert . True ( authenticationInfo . HasIamCredentials ) ;
105+
106+ var iamCredentials = authenticationInfo . IamCredentials ! ;
102107 Assert . Equal ( ClusterName , iamCredentials . ClusterName ) ;
103108 Assert . Equal ( Region , iamCredentials . Region ) ;
104109 Assert . Equal ( FFI . ServiceType . MemoryDB , iamCredentials . ServiceType ) ;
105- Assert . Null ( iamCredentials . RefreshIntervalSeconds ) ;
110+ Assert . False ( iamCredentials . HasRefreshIntervalSeconds ) ;
106111 }
107112
108113 [ Fact ]
@@ -115,14 +120,16 @@ public void WithCredentials()
115120
116121 var config = builder . Build ( ) ;
117122 var authenticationInfo = config . Request . AuthenticationInfo ! . Value ;
118- var iamCredentials = authenticationInfo . IamCredentials ! . Value ;
119123
120124 Assert . Equal ( Username , authenticationInfo . Username ) ;
121125 Assert . Null ( authenticationInfo . Password ) ;
126+ Assert . True ( authenticationInfo . HasIamCredentials ) ;
127+
128+ var iamCredentials = authenticationInfo . IamCredentials ! ;
122129 Assert . Equal ( ClusterName , iamCredentials . ClusterName ) ;
123130 Assert . Equal ( Region , iamCredentials . Region ) ;
124131 Assert . Equal ( FFI . ServiceType . MemoryDB , iamCredentials . ServiceType ) ;
125- Assert . Null ( iamCredentials . RefreshIntervalSeconds ) ;
132+ Assert . False ( iamCredentials . HasRefreshIntervalSeconds ) ;
126133
127134 // Credentials cannot be null.
128135 Assert . Throws < ArgumentNullException > ( ( ) => builder . WithCredentials ( null ! ) ) ;
@@ -145,7 +152,7 @@ public void WithCredentials_MultipleCalls_LastWins()
145152
146153 Assert . Equal ( Username , authenticationInfo . Username ) ;
147154 Assert . Equal ( Password , authenticationInfo . Password ) ;
148- Assert . Null ( authenticationInfo . IamCredentials ) ;
155+ Assert . False ( authenticationInfo . HasIamCredentials ) ;
149156
150157 // IAM authentication last.
151158 builder = new StandaloneClientConfigurationBuilder ( ) ;
@@ -154,13 +161,15 @@ public void WithCredentials_MultipleCalls_LastWins()
154161
155162 config = builder . Build ( ) ;
156163 authenticationInfo = config ! . Request . AuthenticationInfo ! . Value ;
157- var iamCredentials = authenticationInfo . IamCredentials ! . Value ;
158164
159165 Assert . Equal ( Username , authenticationInfo . Username ) ;
160166 Assert . Null ( authenticationInfo . Password ) ;
167+ Assert . True ( authenticationInfo . HasIamCredentials ) ;
168+
169+ var iamCredentials = authenticationInfo . IamCredentials ! ;
161170 Assert . Equal ( ClusterName , iamCredentials . ClusterName ) ;
162171 Assert . Equal ( Region , iamCredentials . Region ) ;
163172 Assert . Equal ( FFI . ServiceType . MemoryDB , iamCredentials . ServiceType ) ;
164- Assert . Null ( iamCredentials . RefreshIntervalSeconds ) ;
173+ Assert . False ( iamCredentials . HasRefreshIntervalSeconds ) ;
165174 }
166175}
0 commit comments