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);
        }
Esempio n. 2
0
 /// <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();
 }
Esempio n. 3
0
        public void GetErrorHandler_NotNull()
        {
            var result = DefaultsFactory.GetErrorHandler();

            Assert.NotNull(result);
        }
Esempio n. 4
0
        public void GetHttpResponseParser_NotNull()
        {
            var result = DefaultsFactory.GetHttpResponseParser();

            Assert.NotNull(result);
        }
Esempio n. 5
0
        public void GetHttpRequester_NotNull(string apiKey)
        {
            var result = DefaultsFactory.GetHttpRequester(apiKey);

            Assert.NotNull(result);
        }