public NpmjsService CreateTarget(INpmjsHttpService npmjsHttpService = null, NpmjsConfiguration config = null) { npmjsHttpService = npmjsHttpService ?? Substitute.For <INpmjsHttpService>(); config = config ?? new NpmjsConfiguration() { PageSize = 2 }; var options = Substitute.For <IOptions <NpmjsConfiguration> >(); options.Value.Returns(config); return(new NpmjsService(npmjsHttpService, options)); }
public NpmjsHttpService CreateTarget(NpmjsConfiguration config = null, HttpClient httpClient = null) { config = config ?? new NpmjsConfiguration() { BaseUrl = "http://base-url" }; var options = Substitute.For <IOptions <NpmjsConfiguration> >(); options.Value.Returns(config); var messageHandler = new MockHttpMessageHandler(); httpClient = httpClient ?? new HttpClient(messageHandler); return(new NpmjsHttpService(httpClient, options)); }