1+ using System . Linq . Expressions ;
12using System . Numerics ;
23using System . Security . Cryptography ;
4+ using Hangfire ;
35using HotChocolate ;
46using HotChocolate . Execution ;
57using Lib9c . GraphQL . Types ;
1012using Mimir . MongoDB . Bson ;
1113using Mimir . MongoDB . Repositories ;
1214using Mimir . MongoDB . Services ;
15+ using Mimir . Services ;
1316using MongoDB . Driver ;
1417using Moq ;
1518
@@ -32,9 +35,13 @@ public ServiceProviderBuilder()
3235 . BindRuntimeType ( typeof ( Address ) , typeof ( AddressType ) )
3336 . BindRuntimeType ( typeof ( BigInteger ) , typeof ( BigIntegerType ) )
3437 . BindRuntimeType ( typeof ( HashDigest < SHA256 > ) , typeof ( HashDigestSHA256Type ) ) ;
38+
39+ var mockClient = new Mock < IBackgroundJobClient > ( ) ;
40+ _serviceCollection . AddSingleton < IBackgroundJobClient > ( mockClient . Object ) ;
3541 }
3642
37- public ServiceProviderBuilder With < T > ( T service ) where T : class
43+ public ServiceProviderBuilder With < T > ( T service )
44+ where T : class
3845 {
3946 _serviceCollection . AddSingleton ( service ) ;
4047 return this ;
@@ -58,7 +65,8 @@ public IServiceProvider Build()
5865 public static async Task < string > ExecuteRequestAsync (
5966 IServiceProvider serviceProvider ,
6067 Action < OperationRequestBuilder > configureRequest ,
61- CancellationToken cancellationToken = default )
68+ CancellationToken cancellationToken = default
69+ )
6270 {
6371 await using var scope = serviceProvider . CreateAsyncScope ( ) ;
6472
@@ -67,8 +75,8 @@ public static async Task<string> ExecuteRequestAsync(
6775 configureRequest ( requestBuilder ) ;
6876 var request = requestBuilder . Build ( ) ;
6977
70- var executor = await scope . ServiceProvider
71- . GetRequiredService < IRequestExecutorResolver > ( )
78+ var executor = await scope
79+ . ServiceProvider . GetRequiredService < IRequestExecutorResolver > ( )
7280 . GetRequestExecutorAsync ( cancellationToken : cancellationToken ) ;
7381 await using var result = await executor . ExecuteAsync ( request , cancellationToken ) ;
7482 result . ExpectOperationResult ( ) ;
0 commit comments