Skip to content

Commit 34767df

Browse files
committed
CR changes
1 parent ea70c12 commit 34767df

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/Microsoft.DotNet.Darc/DarcLib/Helpers/GithubResourceConverters.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ internal static Models.PullRequest ConvertPullRequest(Octokit.PullRequest pr)
3232

3333
internal static GithubPullRequestReviews ConvertPullRequestReviews(IEnumerable<PullRequestReview> pullRequestReviews)
3434
{
35-
IEnumerable<GithubReview> reviews = pullRequestReviews
35+
var reviews = pullRequestReviews
3636
.Select(r => new GithubReview(
3737
TranslateReviewState(r.State.Value),
3838
r.PullRequestUrl,
3939
r.User.Login,
4040
r.SubmittedAt))
41-
.ToList();
41+
.ToArray();
4242

4343
return new GithubPullRequestReviews
4444
{

src/Microsoft.DotNet.Darc/DarcLib/Models/GitHub/GithubPullRequestReviews.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Microsoft.DotNet.DarcLib.Models;
88
public class GithubPullRequestReviews : IGithubEtagResource
99
{
10-
public IEnumerable<GithubReview> Reviews { get; set; }
10+
public IReadOnlyCollection<GithubReview> Reviews { get; set; }
1111
public string Etag { get; set; }
1212

1313
}

test/Microsoft.DotNet.DarcLib.Tests/GitHubClientTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ protected override async Task<T> RequestResourceUsingEtagsAsync<T, K>(
164164
IGitHubClient client,
165165
Func<K, T> resourceConverter)
166166
{
167-
await Task.FromResult<T>(null);
168167
if (typeof(K) == typeof(List<PullRequestReview>))
169168
{
170169
var match = ReviewsUriPattern.Match(resourceUri.ToString());
@@ -174,9 +173,9 @@ protected override async Task<T> RequestResourceUsingEtagsAsync<T, K>(
174173
var key = Tuple.Create(owner, repo, id);
175174
if (_reviewData.TryGetValue(key, out var reviews))
176175
{
177-
return resourceConverter((K)(object)reviews);
176+
return await Task.FromResult(resourceConverter((K)(object)reviews));
178177
}
179-
return resourceConverter((K)(object)new List<PullRequestReview>());
178+
return await Task.FromResult(resourceConverter((K)(object)new List<PullRequestReview>()));
180179
}
181180
throw new NotImplementedException($"The test client has no implementation for the requested resources of type {typeof(K)}");
182181
}

0 commit comments

Comments
 (0)