@@ -118,8 +118,10 @@ public async Task SetCustomUserClaimsWithWrongUid()
118
118
{
119
119
var customClaims = new Dictionary < string , object > ( ) ;
120
120
121
- await Assert . ThrowsAsync < FirebaseException > (
121
+ var exception = await Assert . ThrowsAsync < FirebaseAuthException > (
122
122
async ( ) => await FirebaseAuth . DefaultInstance . SetCustomUserClaimsAsync ( "non.existing" , customClaims ) ) ;
123
+
124
+ Assert . Equal ( AuthErrorCode . UserNotFound , exception . AuthErrorCode ) ;
123
125
}
124
126
125
127
[ Fact ]
@@ -150,8 +152,10 @@ public async Task CreateUserWithParams()
150
152
Assert . False ( user . Disabled ) ;
151
153
152
154
// Cannot recreate the same user.
153
- await Assert . ThrowsAsync < FirebaseException > (
155
+ var exception = await Assert . ThrowsAsync < FirebaseAuthException > (
154
156
async ( ) => await FirebaseAuth . DefaultInstance . CreateUserAsync ( args ) ) ;
157
+
158
+ Assert . Equal ( AuthErrorCode . UidAlreadyExists , exception . AuthErrorCode ) ;
155
159
}
156
160
finally
157
161
{
@@ -247,23 +251,29 @@ public async Task UserLifecycle()
247
251
{
248
252
// Delete user
249
253
await FirebaseAuth . DefaultInstance . DeleteUserAsync ( uid ) ;
250
- await Assert . ThrowsAsync < FirebaseException > (
254
+ var exception = await Assert . ThrowsAsync < FirebaseAuthException > (
251
255
async ( ) => await FirebaseAuth . DefaultInstance . GetUserAsync ( uid ) ) ;
256
+
257
+ Assert . Equal ( AuthErrorCode . UserNotFound , exception . AuthErrorCode ) ;
252
258
}
253
259
}
254
260
255
261
[ Fact ]
256
262
public async Task GetUserNonExistingUid ( )
257
263
{
258
- await Assert . ThrowsAsync < FirebaseException > (
264
+ var exception = await Assert . ThrowsAsync < FirebaseAuthException > (
259
265
async ( ) => await FirebaseAuth . DefaultInstance . GetUserAsync ( "non.existing" ) ) ;
266
+
267
+ Assert . Equal ( AuthErrorCode . UserNotFound , exception . AuthErrorCode ) ;
260
268
}
261
269
262
270
[ Fact ]
263
271
public async Task GetUserNonExistingEmail ( )
264
272
{
265
- await Assert . ThrowsAsync < FirebaseException > (
273
+ var exception = await Assert . ThrowsAsync < FirebaseAuthException > (
266
274
async ( ) => await FirebaseAuth . DefaultInstance . GetUserByEmailAsync ( "[email protected] " ) ) ;
275
+
276
+ Assert . Equal ( AuthErrorCode . UserNotFound , exception . AuthErrorCode ) ;
267
277
}
268
278
269
279
[ Fact ]
@@ -273,15 +283,20 @@ public async Task UpdateUserNonExistingUid()
273
283
{
274
284
Uid = "non.existing" ,
275
285
} ;
276
- await Assert . ThrowsAsync < FirebaseException > (
286
+
287
+ var exception = await Assert . ThrowsAsync < FirebaseAuthException > (
277
288
async ( ) => await FirebaseAuth . DefaultInstance . UpdateUserAsync ( args ) ) ;
289
+
290
+ Assert . Equal ( AuthErrorCode . UserNotFound , exception . AuthErrorCode ) ;
278
291
}
279
292
280
293
[ Fact ]
281
294
public async Task DeleteUserNonExistingUid ( )
282
295
{
283
- await Assert . ThrowsAsync < FirebaseException > (
296
+ var exception = await Assert . ThrowsAsync < FirebaseAuthException > (
284
297
async ( ) => await FirebaseAuth . DefaultInstance . DeleteUserAsync ( "non.existing" ) ) ;
298
+
299
+ Assert . Equal ( AuthErrorCode . UserNotFound , exception . AuthErrorCode ) ;
285
300
}
286
301
287
302
[ Fact ]
0 commit comments