mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
next batch of test cleanup (#2004)
This commit is contained in:
@@ -45,7 +45,7 @@ public class MigrationsClientTests : IDisposable
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task StartNewMigration()
|
private async Task StartNewMigration()
|
||||||
{
|
{
|
||||||
var repoNames = _repos.Select(repo => repo.Repository.FullName).ToList();
|
var repoNames = _repos.Select(repo => repo.Repository.FullName).ToList();
|
||||||
var migrationRequest = new StartMigrationRequest(repoNames);
|
var migrationRequest = new StartMigrationRequest(repoNames);
|
||||||
|
|||||||
@@ -100,8 +100,10 @@ namespace Octokit.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[MemberData("PagingMethods")]
|
[MemberData(nameof(PagingMethods))]
|
||||||
|
#pragma warning disable xUnit1026 // Theory methods should use all of their parameters
|
||||||
public void ReturnsNullIfThereIsNoMatchingPagingLink(string ignored, Func<ApiInfo, Uri> pagingMethod)
|
public void ReturnsNullIfThereIsNoMatchingPagingLink(string ignored, Func<ApiInfo, Uri> pagingMethod)
|
||||||
|
#pragma warning restore xUnit1026 // Theory methods should use all of their parameters
|
||||||
{
|
{
|
||||||
var links = new Dictionary<string, Uri>();
|
var links = new Dictionary<string, Uri>();
|
||||||
var info = BuildApiInfo(links);
|
var info = BuildApiInfo(links);
|
||||||
|
|||||||
@@ -86,13 +86,9 @@ namespace Octokit.Tests.Http
|
|||||||
|
|
||||||
Assert.NotSame(original.RateLimit, clone.RateLimit);
|
Assert.NotSame(original.RateLimit, clone.RateLimit);
|
||||||
Assert.Equal(original.RateLimit.Limit, clone.RateLimit.Limit);
|
Assert.Equal(original.RateLimit.Limit, clone.RateLimit.Limit);
|
||||||
Assert.NotSame(original.RateLimit.Limit, clone.RateLimit.Limit);
|
|
||||||
Assert.Equal(original.RateLimit.Remaining, clone.RateLimit.Remaining);
|
Assert.Equal(original.RateLimit.Remaining, clone.RateLimit.Remaining);
|
||||||
Assert.NotSame(original.RateLimit.Remaining, clone.RateLimit.Remaining);
|
|
||||||
Assert.Equal(original.RateLimit.ResetAsUtcEpochSeconds, clone.RateLimit.ResetAsUtcEpochSeconds);
|
Assert.Equal(original.RateLimit.ResetAsUtcEpochSeconds, clone.RateLimit.ResetAsUtcEpochSeconds);
|
||||||
Assert.NotSame(original.RateLimit.ResetAsUtcEpochSeconds, clone.RateLimit.ResetAsUtcEpochSeconds);
|
|
||||||
Assert.Equal(original.RateLimit.Reset, clone.RateLimit.Reset);
|
Assert.Equal(original.RateLimit.Reset, clone.RateLimit.Reset);
|
||||||
Assert.NotSame(original.RateLimit.Reset, clone.RateLimit.Reset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -753,7 +753,7 @@ namespace Octokit.Tests.Http
|
|||||||
var connection = new Connection(new ProductHeaderValue("OctokitTests"), new Uri("https://github.com/"));
|
var connection = new Connection(new ProductHeaderValue("OctokitTests"), new Uri("https://github.com/"));
|
||||||
|
|
||||||
Assert.Equal(new Uri("https://github.com/"), connection.BaseAddress);
|
Assert.Equal(new Uri("https://github.com/"), connection.BaseAddress);
|
||||||
Assert.True(connection.UserAgent.StartsWith("OctokitTests ("));
|
Assert.StartsWith("OctokitTests (", connection.UserAgent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace Octokit.Tests.Http
|
|||||||
|
|
||||||
var response = jsonPipeline.DeserializeResponse<List<SomeObject>>(httpResponse);
|
var response = jsonPipeline.DeserializeResponse<List<SomeObject>>(httpResponse);
|
||||||
|
|
||||||
Assert.Equal(1, response.Body.Count);
|
Assert.Single(response.Body);
|
||||||
Assert.Equal("Haack", response.Body.First().Name);
|
Assert.Equal("Haack", response.Body.First().Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,17 +117,13 @@ namespace Octokit.Tests.Http
|
|||||||
|
|
||||||
var clone = original.Clone();
|
var clone = original.Clone();
|
||||||
|
|
||||||
// Note the use of Assert.NotSame tests for value types - this should continue to test should the underlying
|
// We want to ensure the original and clone are different objects but with
|
||||||
// model are changed to Object types
|
// the same values populated
|
||||||
Assert.NotSame(original, clone);
|
Assert.NotSame(original, clone);
|
||||||
Assert.Equal(original.Limit, clone.Limit);
|
Assert.Equal(original.Limit, clone.Limit);
|
||||||
Assert.NotSame(original.Limit, clone.Limit);
|
|
||||||
Assert.Equal(original.Remaining, clone.Remaining);
|
Assert.Equal(original.Remaining, clone.Remaining);
|
||||||
Assert.NotSame(original.Remaining, clone.Remaining);
|
|
||||||
Assert.Equal(original.ResetAsUtcEpochSeconds, clone.ResetAsUtcEpochSeconds);
|
Assert.Equal(original.ResetAsUtcEpochSeconds, clone.ResetAsUtcEpochSeconds);
|
||||||
Assert.NotSame(original.ResetAsUtcEpochSeconds, clone.ResetAsUtcEpochSeconds);
|
|
||||||
Assert.Equal(original.Reset, clone.Reset);
|
Assert.Equal(original.Reset, clone.Reset);
|
||||||
Assert.NotSame(original.Reset, clone.Reset);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace Octokit.Tests.Http
|
|||||||
|
|
||||||
var response = await adapter.SendAsync(httpRequestMessage, new CancellationToken());
|
var response = await adapter.SendAsync(httpRequestMessage, new CancellationToken());
|
||||||
|
|
||||||
Assert.Equal(response.StatusCode, HttpStatusCode.OK);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
Assert.Same(response.RequestMessage, httpRequestMessage);
|
Assert.Same(httpRequestMessage, response.RequestMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class NewReferenceTests
|
|||||||
{
|
{
|
||||||
var create = new NewReference("heads/develop", "sha");
|
var create = new NewReference("heads/develop", "sha");
|
||||||
|
|
||||||
Assert.Equal(create.Ref, "refs/heads/develop");
|
Assert.Equal("refs/heads/develop", create.Ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -125,12 +125,12 @@ namespace Octokit.Tests.Reactive
|
|||||||
readonly IGitHubClient _githubClient = Substitute.For<IGitHubClient>();
|
readonly IGitHubClient _githubClient = Substitute.For<IGitHubClient>();
|
||||||
ObservableDeploymentStatusClient _client;
|
ObservableDeploymentStatusClient _client;
|
||||||
|
|
||||||
public void SetupWithoutNonReactiveClient()
|
private void SetupWithoutNonReactiveClient()
|
||||||
{
|
{
|
||||||
_client = new ObservableDeploymentStatusClient(_githubClient);
|
_client = new ObservableDeploymentStatusClient(_githubClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupWithNonReactiveClient()
|
private void SetupWithNonReactiveClient()
|
||||||
{
|
{
|
||||||
var deploymentStatusClient = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
var deploymentStatusClient = new DeploymentStatusClient(Substitute.For<IApiConnection>());
|
||||||
_githubClient.Repository.Deployment.Status.Returns(deploymentStatusClient);
|
_githubClient.Repository.Deployment.Status.Returns(deploymentStatusClient);
|
||||||
|
|||||||
Reference in New Issue
Block a user