mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-04 03:16:11 +00:00
[Fix]: The methods GetAllForCurrentWithTimestamps and GetAllForUserWithTimestamps now return timestamps.
* Fix unit tests. * Fix integration tests. * Fix to use `AcceptHeaders.StarJson`. --------- Co-authored-by: Nick Floyd <139819+nickfloyd@users.noreply.github.com>
This commit is contained in:
@@ -167,6 +167,8 @@ namespace Octokit.Tests.Integration.Clients
|
||||
|
||||
var repo = stars.FirstOrDefault(star => star.Repo.Owner.Login == _repositoryContext.RepositoryOwner && star.Repo.Name == _repositoryContext.RepositoryName);
|
||||
Assert.NotNull(repo);
|
||||
Assert.NotEqual(DateTimeOffset.MinValue, repo.StarredAt);
|
||||
Assert.NotNull(repo.Repo);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
@@ -232,6 +234,8 @@ namespace Octokit.Tests.Integration.Clients
|
||||
|
||||
var repo = stars.FirstOrDefault(star => star.Repo.Owner.Login == _repositoryContext.RepositoryOwner && star.Repo.Name == _repositoryContext.RepositoryName);
|
||||
Assert.NotNull(repo);
|
||||
Assert.NotEqual(DateTimeOffset.MinValue, repo.StarredAt);
|
||||
Assert.NotNull(repo.Repo);
|
||||
|
||||
for (int i = 1; i < stars.Count; i++)
|
||||
{
|
||||
@@ -456,6 +460,8 @@ namespace Octokit.Tests.Integration.Clients
|
||||
|
||||
var star = stars.FirstOrDefault(repositoryStar => repositoryStar.Repo.Owner.Login == _repositoryContext.RepositoryOwner && repositoryStar.Repo.Name == _repositoryContext.RepositoryName);
|
||||
Assert.NotNull(star);
|
||||
Assert.NotEqual(DateTimeOffset.MinValue, star.StarredAt);
|
||||
Assert.NotNull(star.Repo);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
@@ -521,6 +527,8 @@ namespace Octokit.Tests.Integration.Clients
|
||||
|
||||
var repo = stars.FirstOrDefault(repository => repository.Repo.Owner.Login == _repositoryContext.RepositoryOwner && repository.Repo.Name == _repositoryContext.RepositoryName);
|
||||
Assert.NotNull(repo);
|
||||
Assert.NotEqual(DateTimeOffset.MinValue, repo.StarredAt);
|
||||
Assert.NotNull(repo.Repo);
|
||||
|
||||
for (int i = 1; i < stars.Count; i++)
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
await client.GetAllForCurrentWithTimestamps();
|
||||
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, null, Args.ApiOptions);
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, null, AcceptHeaders.StarJson, Args.ApiOptions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -118,7 +118,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
await client.GetAllForCurrentWithTimestamps(options);
|
||||
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, null, options);
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, null, AcceptHeaders.StarJson, options);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -132,7 +132,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
await client.GetAllForCurrentWithTimestamps(request);
|
||||
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["direction"] == "asc"), Args.ApiOptions);
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["direction"] == "asc"), AcceptHeaders.StarJson, Args.ApiOptions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -153,7 +153,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
await client.GetAllForCurrentWithTimestamps(request, options);
|
||||
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["direction"] == "asc"), options);
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["direction"] == "asc"), AcceptHeaders.StarJson, options);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -250,7 +250,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
await client.GetAllForUserWithTimestamps("banana");
|
||||
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, null, Args.ApiOptions);
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, null, AcceptHeaders.StarJson, Args.ApiOptions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -269,7 +269,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
await client.GetAllForUserWithTimestamps("banana", options);
|
||||
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, null, options);
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, null, AcceptHeaders.StarJson, options);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -283,7 +283,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
await client.GetAllForUserWithTimestamps("banana", starredRequest);
|
||||
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["direction"] == "asc"), Args.ApiOptions);
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["direction"] == "asc"), AcceptHeaders.StarJson, Args.ApiOptions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -304,7 +304,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
await client.GetAllForUserWithTimestamps("banana", starredRequest, options);
|
||||
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["direction"] == "asc"), options);
|
||||
connection.Received().GetAll<RepositoryStar>(endpoint, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["direction"] == "asc"), AcceptHeaders.StarJson, options);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace Octokit
|
||||
{
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return ApiConnection.GetAll<RepositoryStar>(ApiUrls.Starred(), null, options);
|
||||
return ApiConnection.GetAll<RepositoryStar>(ApiUrls.Starred(), null, AcceptHeaders.StarJson, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -237,7 +237,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNull(request, nameof(request));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return ApiConnection.GetAll<RepositoryStar>(ApiUrls.Starred(), request.ToParametersDictionary(), options);
|
||||
return ApiConnection.GetAll<RepositoryStar>(ApiUrls.Starred(), request.ToParametersDictionary(), AcceptHeaders.StarJson, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -293,7 +293,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return ApiConnection.GetAll<RepositoryStar>(ApiUrls.StarredByUser(user), null, options);
|
||||
return ApiConnection.GetAll<RepositoryStar>(ApiUrls.StarredByUser(user), null, AcceptHeaders.StarJson, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -359,7 +359,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNull(request, nameof(request));
|
||||
Ensure.ArgumentNotNull(options, nameof(options));
|
||||
|
||||
return ApiConnection.GetAll<RepositoryStar>(ApiUrls.StarredByUser(user), request.ToParametersDictionary(), options);
|
||||
return ApiConnection.GetAll<RepositoryStar>(ApiUrls.StarredByUser(user), request.ToParametersDictionary(), AcceptHeaders.StarJson, options);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user