/// <summary> /// Initializes a new instance of the <see cref="RemoteService{TApiService}"/> class. /// </summary> /// <param name="apiService">Instance of API service.</param> /// <param name="executorFactory">The factory instance to create request executor.</param> public RemoteService( TApiService apiService, IExecutorBuilderFactory executorFactory) { _apiService = apiService; _executorFactory = executorFactory; }
public RemoteServiceTests() { var testException = new Exception("TEST EXCEPTION"); _apiService = Substitute.For <IStubApiInterface>(); _apiService.GetData(Arg.Any <CancellationToken>()).Returns(ResultData); _apiService.DoException().Throws(testException); _apiService.DoException(Arg.Any <CancellationToken>()).Throws(testException); _executorBuilder = new DefaultExecutorBuilderFactory(); _remoteService = new RemoteService <IStubApiInterface>(_apiService, _executorBuilder); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteServiceFactory"/> class. /// </summary> /// <param name="apiServiceFactory"> /// Instance of <see cref="IApiServiceFactory"/>. /// Default value is <see cref="RefitApiServiceFactory"/>. /// </param> public RemoteServiceFactory(IApiServiceFactory?apiServiceFactory = null) { _apiServiceFactory = apiServiceFactory ?? new RefitApiServiceFactory(); _executorBuilderFactory = new DefaultExecutorBuilderFactory(); }