Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterOrneholm committed Apr 11, 2024
1 parent cb5e05f commit e7e6237
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 36 deletions.
7 changes: 4 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"sdk": {
"version": "3.1.100"
}
"sdk": {
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UserSecretsId>40efe3b4-97f3-436c-9841-9622696c8d35</UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<UserSecretsId>40efe3b4-97f3-436c-9841-9622696c8d35</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.8.1" />
<PackageReference Include="Orneholm.SverigesRadio.Api" Version="1.0.0-beta-1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Orneholm.SverigesRadio.Api" Version="1.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
5 changes: 5 additions & 0 deletions src/Orneholm.SverigesRadio.Api/HttpClientExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ internal static async Task<TResult> GetAsync<TResult>(this HttpClient httpClient
var contentStream = await httpResponseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false);
var parsedContent = await JsonSerializer.DeserializeAsync<TResult>(contentStream, JsonSerializerOptions).ConfigureAwait(false);

if (parsedContent == null)
{
throw new Exception("Failed to parse content");
}

return parsedContent;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="System.Text.Json" Version="4.7.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="System.Text.Json" Version="9.0.0-preview.2.24128.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, Jso
Debug.Assert(typeToConvert == typeof(DateTime));

var value = reader.GetString();
if (value.StartsWith("/Date("))
if (value != null && value.StartsWith("/Date("))
{
var dateValue = value.Substring(6, value.Length - 8);
var parts = dateValue.Split('+');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

<IsPackable>false</IsPackable>
</PropertyGroup>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0-release-24177-07" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Orneholm.SverigesRadio.Api\Orneholm.SverigesRadio.Api.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Orneholm.SverigesRadio.Api\Orneholm.SverigesRadio.Api.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;

using Xunit;

namespace Orneholm.SverigesRadio.Api.Test.SverigesRadioApiClient
Expand All @@ -12,7 +13,7 @@ public async Task ListExtraBroadcasts()
var result = await ApiClient.ListExtraBroadcastsAsync(pagination: FirstOneItemPagination);

// Assert
Assert.Equal(1, result.Broadcasts.Count);
Assert.Single(result.Broadcasts);
}
}
}

0 comments on commit e7e6237

Please sign in to comment.