private void CreateMock(AutoMock mock) { var defaults = new DefaultsFactory(); var mockSQLiteRepository = new MockSQLiteRepository(defaults); mock.Provide <ISQLiteRepository>(mockSQLiteRepository); // using the real settings factory because it's just a POCO var realSettingsFactory = new SettingsFactory(defaults); mock.Provide <ISettingsFactory>(realSettingsFactory); }
/// <summary> /// Creates a new instance of an Astronomy Picture of the Day client, overriding the internal logic. /// </summary> /// <remarks> /// This constructor can be used for overriding internal logic in the client. /// The average user should not need to call this constructor. /// </remarks> /// <param name="apiKey">Your API key from https://api.nasa.gov.</param> /// <param name="httpRequester">The <see cref="IHttpRequester"/> to use for interacting with the API.</param> /// <param name="httpResponseParser">The <see cref="IHttpResponseParser"/> to use for parsing the data from the <paramref name="httpRequester"/>.</param> /// <param name="errorHandler">The <see cref="IErrorHandler"/> to handle any errors with the request.</param> /// <example> /// See <a href="../examples/errorhandler.md">Override the IErrorHandler</a> for an example on how to implement and use any of these interfaces. /// </example> public ApodClient(string apiKey, IHttpRequester httpRequester = null, IHttpResponseParser httpResponseParser = null, IErrorHandler errorHandler = null) { _httpRequester = httpRequester ?? DefaultsFactory.GetHttpRequester(apiKey); _httpResponseParser = httpResponseParser ?? DefaultsFactory.GetHttpResponseParser(); _errorHandler = errorHandler ?? DefaultsFactory.GetErrorHandler(); }
public void GetErrorHandler_NotNull() { var result = DefaultsFactory.GetErrorHandler(); Assert.NotNull(result); }
public void GetHttpResponseParser_NotNull() { var result = DefaultsFactory.GetHttpResponseParser(); Assert.NotNull(result); }
public void GetHttpRequester_NotNull(string apiKey) { var result = DefaultsFactory.GetHttpRequester(apiKey); Assert.NotNull(result); }