@@ -79,17 +79,18 @@ public void CannotRegisterAccountWithDisallowedEmailAddress()
7979 }
8080
8181 [ Test ]
82- public void CannotRegisterAccountsWithDisallowedEmailDomain ( )
82+ [ TestCase ( "guy@moron.com" ) ] // whole address
83+ [ TestCase ( "moron.com" ) ] // just the domain
84+ public void CannotRegisterAccountsWithDisallowedEmailDomain ( string addressToBlockWith )
8385 {
8486 using TestContext context = this . GetServer ( ) ;
8587
86- const string email = "guy@moron.com" ;
8788 // Not somehow already disallowed
88- Assert . That ( context . Database . IsEmailDomainDisallowed ( email ) , Is . False ) ;
89- context . Database . DisallowEmailDomain ( email ) ;
89+ Assert . That ( context . Database . IsEmailDomainDisallowed ( addressToBlockWith ) , Is . False ) ;
90+ context . Database . DisallowEmailDomain ( addressToBlockWith ) ;
9091
9192 context . Database . Refresh ( ) ;
92- Assert . That ( context . Database . IsEmailDomainDisallowed ( email ) , Is . True ) ;
93+ Assert . That ( context . Database . IsEmailDomainDisallowed ( addressToBlockWith ) , Is . True ) ;
9394
9495 // Attempt 1 (block)
9596 ApiResponse < ApiAuthenticationResponse > ? response = context . Http . PostData < ApiAuthenticationResponse > ( "/api/v3/register" , new ApiRegisterRequest
@@ -148,9 +149,9 @@ public void CannotRegisterAccountsWithDisallowedEmailDomain()
148149 Assert . That ( quacker ! . Username , Is . EqualTo ( "a_lil_guy" ) ) ;
149150
150151 // Undo
151- context . Database . ReallowEmailDomain ( email ) ;
152+ context . Database . ReallowEmailDomain ( addressToBlockWith ) ;
152153 context . Database . Refresh ( ) ;
153- Assert . That ( context . Database . IsEmailDomainDisallowed ( email ) , Is . False ) ;
154+ Assert . That ( context . Database . IsEmailDomainDisallowed ( addressToBlockWith ) , Is . False ) ;
154155 }
155156
156157 [ Test ]
0 commit comments