Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd committed Jan 2, 2024
2 parents 6ca8b9e + 0e38662 commit 2b9c655
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/immediate-response.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
issues:
types:
- opened
pull_request:
pull_request_target:
types:
- opened
jobs:
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
Expand Down
2 changes: 1 addition & 1 deletion Octokit.Tests.Integration/Clients/ReleasesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task CreateReleaseAsLatest()
var firstReleaseRequest = new NewRelease("0.1") { MakeLatest = MakeLatestQualifier.False };
await _releaseClient.Create(_context.Repository.Id, firstReleaseRequest);

Assert.ThrowsAsync<NotFoundException>(async () => await _releaseClient.GetLatest(_context.RepositoryOwner, _context.RepositoryName));
await Assert.ThrowsAsync<NotFoundException>(async () => await _releaseClient.GetLatest(_context.RepositoryOwner, _context.RepositoryName));

var secondReleaseRequest = new NewRelease("0.2") { MakeLatest = MakeLatestQualifier.True };
var secondRelease = await _releaseClient.Create(_context.Repository.Id, secondReleaseRequest);
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<PackageReference Include="GitHubJwt" Version="0.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests/AsyncEnumerableExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ public class AsyncEnumerableExtensionTests
public class ThePaginatedList
{
[Fact]
public void RejectsInvalidValues()
public async Task RejectsInvalidValues()
{
var client = Substitute.For<IRepositoriesClient>();

Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => client.GetAllForOrgAsync("octokit")[-1]);
await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => client.GetAllForOrgAsync("octokit")[-1]);
}

[Fact]
Expand Down Expand Up @@ -72,7 +72,7 @@ public class ThePaginationOverloads
public void RejectInvalidValues()
{
var client = Substitute.For<IRepositoriesClient>();

Assert.Throws<ArgumentOutOfRangeException>(() => client.GetAllForUserAsync("fake", -1));
Assert.Throws<ArgumentOutOfRangeException>(() => client.GetAllForUserAsync("fake", 0));
}
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Caching/CachingHttpClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CachingHttpClientTests
public class TheSendMethod
{
[Fact]
public void EnsuresNonNullArguments()
public async Task EnsuresNonNullArguments()
{
// arrange
var underlyingClient = Substitute.For<IHttpClient>();
Expand All @@ -29,7 +29,7 @@ public void EnsuresNonNullArguments()
var cachingHttpClient = new CachingHttpClient(underlyingClient, responseCache);

// act + assert
Assert.ThrowsAsync<ArgumentNullException>(() => cachingHttpClient.Send(null, CancellationToken.None));
await Assert.ThrowsAsync<ArgumentNullException>(() => cachingHttpClient.Send(null, CancellationToken.None));
}

[Theory]
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Clients/LicensesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public void EnsuresNonNullArguments()
public class TheGetAllLicensesMethod
{
[Fact]
public void EnsuresNonNullArguments()
public async Task EnsuresNonNullArguments()
{
var client = new LicensesClient(Substitute.For<IApiConnection>());

Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllLicenses(null));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllLicenses(null));
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Clients/MiscellaneousClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ public void EnsuresNonNullArguments()
public class TheGetAllLicensesMethod
{
[Fact]
public void EnsuresNonNullArguments()
public async Task EnsuresNonNullArguments()
{
var client = new MiscellaneousClient(Substitute.For<IApiConnection>());

Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllLicenses(null));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllLicenses(null));
}

[Fact]
Expand Down
16 changes: 8 additions & 8 deletions Octokit.Tests/Clients/OrganizationHooksClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public async Task EnsuresNonNullArguments()
}

[Fact]
public void EnsuresNonEmptyArguments()
public async Task EnsuresNonEmptyArguments()
{
var client = new OrganizationsClient(Substitute.For<IApiConnection>());
var config = new Dictionary<string, string> { { "url", "" } };
Assert.ThrowsAsync<ArgumentException>(() => client.Hook.Create("", new NewOrganizationHook("name", config)));
await Assert.ThrowsAsync<ArgumentException>(() => client.Hook.Create("", new NewOrganizationHook("name", config)));
}

[Fact]
Expand Down Expand Up @@ -167,10 +167,10 @@ public async Task EnsuresNonNullArguments()
}

[Fact]
public void EnsuresNonEmptyArguments()
public async Task EnsuresNonEmptyArguments()
{
var client = new OrganizationsClient(Substitute.For<IApiConnection>());
Assert.ThrowsAsync<ArgumentException>(() => client.Hook.Edit("", 123, new EditOrganizationHook()));
await Assert.ThrowsAsync<ArgumentException>(() => client.Hook.Edit("", 123, new EditOrganizationHook()));
}

[Fact]
Expand All @@ -197,10 +197,10 @@ public async Task EnsuresNonNullArguments()
}

[Fact]
public void EnsuresNonEmptyArguments()
public async Task EnsuresNonEmptyArguments()
{
var client = new OrganizationsClient(Substitute.For<IApiConnection>());
Assert.ThrowsAsync<ArgumentException>(() => client.Hook.Ping("", 123));
await Assert.ThrowsAsync<ArgumentException>(() => client.Hook.Ping("", 123));
}

[Fact]
Expand Down Expand Up @@ -237,10 +237,10 @@ public async Task EnsuresNonNullArguments()
}

[Fact]
public void EnsuresNonEmptyArguments()
public async Task EnsuresNonEmptyArguments()
{
var client = new OrganizationsClient(Substitute.For<IApiConnection>());
Assert.ThrowsAsync<ArgumentException>(() => client.Hook.Delete("", 123));
await Assert.ThrowsAsync<ArgumentException>(() => client.Hook.Delete("", 123));
}

}
Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Octokit.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
Expand Down
15 changes: 12 additions & 3 deletions Octokit/Http/ProductHeaderValue.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Octokit
using System;

namespace Octokit
{
/// <summary>
/// Represents a product header value. This is used to generate the User Agent string sent with each request. The
Expand Down Expand Up @@ -38,9 +40,16 @@ public ProductHeaderValue(string name, string version)
{
}

ProductHeaderValue(System.Net.Http.Headers.ProductHeaderValue productHeader)
/// <summary>
/// Initializes a new instance of the <see cref="ProductHeaderValue"/> class.
/// </summary>
/// <remarks>
/// See more information regarding User-Agent requirements here: https://developer.github.com/v3/#user-agent-required
/// </remarks>
/// <param name="productHeader">The <see cref="System.Net.Http.Headers.ProductHeaderValue"/>.</param>
public ProductHeaderValue(System.Net.Http.Headers.ProductHeaderValue productHeader)
{
_productHeaderValue = productHeader;
_productHeaderValue = productHeader ?? throw new ArgumentNullException(nameof(productHeader));
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions build/Build.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="Cake.Coverlet" Version="3.0.4" />
<PackageReference Include="Cake.Frosting" Version="2.3.0" />
<PackageReference Include="Cake.Frosting" Version="4.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion build/Lifetime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

public class Lifetime : FrostingLifetime<Context>
{
public override void Setup(Context context)
public override void Setup(Context context, ISetupContext setupContext)
{
context.Target = context.Argument("target", "Default");
context.Configuration = context.Argument("configuration", "Release");
Expand Down

0 comments on commit 2b9c655

Please sign in to comment.