private static SqlProjectSearchRepository CreateRepositoryWithExceptionExpectation <T>(Exception exception)
        {
            var connectionWrapper = new SqlConnectionWrapperMock();

            connectionWrapper.Setup(
                t => t.QueryAsync <T>("GetProjectsByName", It.IsAny <object>(), It.IsAny <IDbTransaction>(),
                                      It.IsAny <int?>(), It.IsAny <CommandType?>())).Throws(exception);

            var configuration = new Mock <ISearchConfiguration>();

            return(new SqlProjectSearchRepository(connectionWrapper.Object, configuration.Object));
        }