コード例 #1
0
        /// <summary>
        /// Creates a <see cref="CodePlexWorkItemReader"/> object.
        /// </summary>
        public CodePlexWorkItemReader(string project, bool includeClosedWorkItems, IHttpClient httpClient)
        {
            ArgValidate.IsNotNullNotEmptyNotWhiteSpace(project, nameof(project));
            ArgValidate.IsNotNull(httpClient, nameof(httpClient));

            this.project = project;
            this.includeClosedWorkItems = includeClosedWorkItems;
            this.httpClient             = httpClient;
        }
        /// <summary>
        /// Creates a <see cref="GitHubRepoIssueReaderWriter"/> object. This object is used to interface with GitHub to manage issues that are being migrated.
        /// </summary>
        public GitHubRepoIssueReaderWriter(string repoOwner, string repo, IIssuesClient issues, ISearchClient search)
        {
            ArgValidate.IsNotNullNotEmptyNotWhiteSpace(repoOwner, nameof(repoOwner));
            ArgValidate.IsNotNullNotEmptyNotWhiteSpace(repo, nameof(repo));
            ArgValidate.IsNotNull(issues, nameof(issues));
            ArgValidate.IsNotNull(search, nameof(search));

            this.repoOwner = repoOwner;
            this.repo      = repo;
            this.issues    = issues;
            this.search    = search;
        }
コード例 #3
0
        /// <summary>
        /// Gets the response string from a uri and returns it as a string.
        /// </summary>
        /// <remarks>
        /// This will throw a <see cref="HttpRequestFailedException"/> on Web and HttpRequest exceptions.
        /// This is to allow for callers to catch these types of exceptions and potentially retry them.
        /// The prupose of this method/class is to allow tests to build a mock and avoid the actual web request.
        /// </remarks>
        public async Task <string> DownloadStringAsync(string uri)
        {
            ArgValidate.IsNotNullNotEmptyNotWhiteSpace(uri, nameof(uri));

            try
            {
                return(await httpClient.GetStringAsync(uri));
            }
            catch (Exception ex) when(ex is WebException || ex is HttpRequestException)
            {
                throw new HttpRequestFailedException($"Failed to get string from {uri}, error is {ex.Message}", ex);
            }
        }
コード例 #4
0
        public Logger(string filePath)
        {
            ArgValidate.IsNotNullNotEmptyNotWhiteSpace(filePath, nameof(filePath));

            RollingFileAppender rollingFileAppender =
                (RollingFileAppender)LogManager
                .GetRepository()
                .GetAppenders()
                .SingleOrDefault(appender => appender is RollingFileAppender);

            if (rollingFileAppender != null)
            {
                rollingFileAppender.File = filePath;
                rollingFileAppender.ActivateOptions();
            }
        }