@@ -331,5 +331,50 @@ public async Task UseValidatorsGenericWithValidationStrategyName()
331331 Assert . Collection ( result . Errors ! ,
332332 nameIsEmpty => Assert . Equal ( NotEmptyNameValidator . Message , nameIsEmpty . Message ) ) ;
333333 }
334+
335+ [ Fact ]
336+ public async Task UseValidatorWithoutRegisteredServiceDescriptor ( )
337+ {
338+ var executor = await TestSetup . CreateRequestExecutor ( builder =>
339+ {
340+ builder . AddFluentValidation ( )
341+ . AddMutationType ( new TestMutation ( field =>
342+ {
343+ field . Argument ( "input" ,
344+ arg => arg . Type < NonNullType < TestPersonInputType > > ( ) . UseFluentValidation ( argument =>
345+ {
346+ argument . UseValidator < NotEmptyNameValidator > ( ) ;
347+ } ) ) ;
348+ } ) ) ;
349+ } ) ;
350+
351+ var result = Assert . IsType < QueryResult > (
352+ await executor . ExecuteAsync ( TestSetup . Mutations . WithEmptyName ) ) ;
353+
354+ var error = Assert . Single ( result . Errors ! ) ;
355+
356+ Assert . Contains ( "No service" , error . Exception ! . Message ) ;
357+ }
358+
359+ [ Fact ]
360+ public async Task UseValidatorsWithoutRegisteredServiceDescriptor ( )
361+ {
362+ var executor = await TestSetup . CreateRequestExecutor ( builder =>
363+ {
364+ builder . AddFluentValidation ( )
365+ . AddMutationType ( new TestMutation ( field =>
366+ {
367+ field . Argument ( "input" ,
368+ arg => arg . Type < NonNullType < TestPersonInputType > > ( ) . UseFluentValidation ( ) ) ;
369+ } ) ) ;
370+ } ) ;
371+
372+ var result = Assert . IsType < QueryResult > (
373+ await executor . ExecuteAsync ( TestSetup . Mutations . WithEmptyName ) ) ;
374+
375+ var error = Assert . Single ( result . Errors ! ) ;
376+
377+ Assert . Contains ( "No service" , error . Exception ! . Message ) ;
378+ }
334379 }
335380}
0 commit comments