DEV Community

Discussion on: Exception handling explained

Collapse
 
mbzmak profile image
MAK

Thx for sharing.
Jonas, I think that the StoreDefaultAccount method, the way you wrote it, will always fail with an InvalidOperationException since every account's owner ID never equals the account ID.
The test should be :

if (account.OwnerId != userId)