Skip to content

Commit

Permalink
upgrade to .net 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsonax committed Nov 29, 2024
1 parent 7ef4d27 commit 0414a3f
Show file tree
Hide file tree
Showing 55 changed files with 133 additions and 107 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
- name: Cache nuget packages
id: cache-nuget
uses: actions/cache@v4
Expand Down
32 changes: 16 additions & 16 deletions .run/CleanAspCore.run.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="CleanAspCore" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/CleanAspCore/CleanAspCore.csproj" />
<option name="LAUNCH_PROFILE_TFM" value="net8.0" />
<option name="LAUNCH_PROFILE_NAME" value="https" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1" />
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0" />
<option name="SEND_DEBUG_REQUEST" value="1" />
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value="" />
<method v="2">
<option name="Build" default="false" projectName="CleanAspCore" projectPath="$PROJECT_DIR$/CleanAspCore/CleanAspCore.csproj" />
</method>
</configuration>
</component>
<configuration default="false" name="CleanAspCore" type="LaunchSettings" factoryName=".NET Launch Settings Profile">
<option name="LAUNCH_PROFILE_PROJECT_FILE_PATH" value="$PROJECT_DIR$/CleanAspCore/CleanAspCore.csproj"/>
<option name="LAUNCH_PROFILE_TFM" value="net9.0"/>
<option name="LAUNCH_PROFILE_NAME" value="https"/>
<option name="USE_EXTERNAL_CONSOLE" value="0"/>
<option name="USE_MONO" value="0"/>
<option name="RUNTIME_ARGUMENTS" value=""/>
<option name="GENERATE_APPLICATIONHOST_CONFIG" value="1"/>
<option name="SHOW_IIS_EXPRESS_OUTPUT" value="0"/>
<option name="SEND_DEBUG_REQUEST" value="1"/>
<option name="ADDITIONAL_IIS_EXPRESS_ARGUMENTS" value=""/>
<method v="2">
<option name="Build" default="false" projectName="CleanAspCore" projectPath="$PROJECT_DIR$/CleanAspCore/CleanAspCore.csproj"/>
</method>
</configuration>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\CleanAspCore.Api.Tests\CleanAspCore.Api.Tests.csproj"/>
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CleanAspCore.Api.TestUtils\CleanAspCore.Api.TestUtils.csproj"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;
using CleanAspCore.Data;
using CleanAspCore.Data.Extensions;
using Microsoft.Extensions.Hosting;

namespace CleanAspCore.Api.TestDataGenerator;

public class TestDataGeneratorService(HrContext context, IHostApplicationLifetime lifetime) : IHostedService
internal sealed class TestDataGeneratorService(HrContext context, IHostApplicationLifetime lifetime) : IHostedService
{
public async Task StartAsync(CancellationToken cancellationToken)
{
Expand Down
17 changes: 17 additions & 0 deletions CleanAspCore.Api.TestUtils/CleanAspCore.Api.TestUtils.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="35.6.1"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CleanAspCore\CleanAspCore.csproj"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Bogus;
using CleanAspCore.Endpoints.Departments;

namespace CleanAspCore.Api.Tests.Fakers;
namespace CleanAspCore.Api.TestUtils.Fakers;

public sealed class CreateDepartmentRequestFaker : Faker<CreateDepartmentRequest>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Bogus;
using CleanAspCore.Endpoints.Employees;

namespace CleanAspCore.Api.Tests.Fakers;
namespace CleanAspCore.Api.TestUtils.Fakers;

public sealed class CreateEmployeeRequestFaker : Faker<CreateEmployeeRequest>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Bogus;
using CleanAspCore.Endpoints.Jobs;

namespace CleanAspCore.Api.Tests.Fakers;
namespace CleanAspCore.Api.TestUtils.Fakers;

public sealed class CreateJobRequestFaker : Faker<CreateJobRequest>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Bogus;
using CleanAspCore.Data.Models.Departments;

namespace CleanAspCore.Api.Tests.Fakers;
namespace CleanAspCore.Api.TestUtils.Fakers;

public sealed class DepartmentFaker : Faker<Department>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using CleanAspCore.Common.ValueObjects;
using CleanAspCore.Data.Models.Employees;

namespace CleanAspCore.Api.Tests.Fakers;
namespace CleanAspCore.Api.TestUtils.Fakers;

public sealed class EmployeeFaker : Faker<Employee>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Bogus;
using CleanAspCore.Data.Models.Jobs;

namespace CleanAspCore.Api.Tests.Fakers;
namespace CleanAspCore.Api.TestUtils.Fakers;

public sealed class JobFaker : Faker<Job>
{
Expand Down
21 changes: 11 additions & 10 deletions CleanAspCore.Api.Tests/CleanAspCore.Api.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="35.6.0"/>
<PackageReference Include="FluentAssertions" Version="6.12.0"/>
<PackageReference Include="Bogus" Version="35.6.1"/>
<PackageReference Include="FluentAssertions" Version="6.12.2"/>
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.7"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.7"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.0"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0"/>

<PackageReference Include="Testcontainers.MsSql" Version="3.9.0"/>
<PackageReference Include="Testcontainers.MsSql" Version="4.0.0"/>
<PackageReference Include="Respawn" Version="6.2.1"/>

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="NUnit" Version="4.1.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="NUnit" Version="4.2.2"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0"/>
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
<PackageReference Include="NUnit.Analyzers" Version="4.4.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Refit" Version="7.1.2"/>
<PackageReference Include="Refit" Version="8.0.0"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CleanAspCore.Api.TestUtils\CleanAspCore.Api.TestUtils.csproj"/>
<ProjectReference Include="..\CleanAspCore\CleanAspCore.csproj"/>
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion CleanAspCore.Api.Tests/Data/MigrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace CleanAspCore.Api.Tests.Data;

[FixtureLifeCycle(LifeCycle.SingleInstance)]
[Parallelizable(ParallelScope.Self)]
public class MigrationTests
internal sealed class MigrationTests
{
#pragma warning disable NUnit1032
private MsSqlContainer _databaseContainer = null!;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;

namespace CleanAspCore.Api.Tests.Endpoints.Departments;

public class AddDepartmentsTests : TestBase
internal sealed class AddDepartmentsTests : TestBase
{
[Test]
public async Task CreateDepartment_IsAdded()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;

namespace CleanAspCore.Api.Tests.Endpoints.Departments;

public class GetDepartmentByIdTests : TestBase
internal sealed class GetDepartmentByIdTests : TestBase
{
[Test]
public async Task GetDepartmentById_ReturnsExpectedDepartment()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace CleanAspCore.Api.Tests.Endpoints.Departments;

public interface IDepartmentApiClient
internal interface IDepartmentApiClient
{
[Get("/departments/{id}")]
Task<HttpResponseMessage> GetDepartmentById(Guid id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;
using CleanAspCore.Endpoints.Employees;

namespace CleanAspCore.Api.Tests.Endpoints.Employees;

public class CreateEmployeeTests : TestBase
internal sealed class CreateEmployeeTests : TestBase
{
[Test]
public async Task CreateEmployee_IsAdded()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;

namespace CleanAspCore.Api.Tests.Endpoints.Employees;

public class DeleteEmployeeByIdTests : TestBase
internal sealed class DeleteEmployeeByIdTests : TestBase
{
[Test]
public async Task DeleteEmployeeById_IsDeleted()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;

namespace CleanAspCore.Api.Tests.Endpoints.Employees;

public class GetEmployeeByIdTests : TestBase
internal sealed class GetEmployeeByIdTests : TestBase
{
[Test]
public async Task GetEmployeeById_ReturnsExpectedEmployee()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;

namespace CleanAspCore.Api.Tests.Endpoints.Employees;

public class GetEmployees : TestBase
internal sealed class GetEmployees : TestBase
{
[Test]
public async Task? GetEmployees_NoEmployees_ReturnsEmptyPage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace CleanAspCore.Api.Tests.Endpoints.Employees;

public interface IEmployeeApiClient
internal interface IEmployeeApiClient
{
[Get("/employees/{id}")]
Task<HttpResponseMessage> GetEmployeeById(Guid id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;
using CleanAspCore.Endpoints.Employees;

namespace CleanAspCore.Api.Tests.Endpoints.Employees;

public class UpdateEmployeeByIdTests : TestBase
internal sealed class UpdateEmployeeByIdTests : TestBase
{
[Test]
public async Task UpdateEmployeeById_IsUpdated()
Expand Down
4 changes: 2 additions & 2 deletions CleanAspCore.Api.Tests/Endpoints/Jobs/CreateJobTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;

namespace CleanAspCore.Api.Tests.Endpoints.Jobs;

public class CreateJobTests : TestBase
internal sealed class CreateJobTests : TestBase
{
[Test]
public async Task CreateJob_IsAdded()
Expand Down
4 changes: 2 additions & 2 deletions CleanAspCore.Api.Tests/Endpoints/Jobs/GetJobByIdTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CleanAspCore.Api.Tests.Fakers;
using CleanAspCore.Api.TestUtils.Fakers;

namespace CleanAspCore.Api.Tests.Endpoints.Jobs;

public class GetJobByIdTests : TestBase
internal sealed class GetJobByIdTests : TestBase
{
[Test]
public async Task GetJobById_ReturnsExpectedJob()
Expand Down
2 changes: 1 addition & 1 deletion CleanAspCore.Api.Tests/Endpoints/Jobs/IJobApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace CleanAspCore.Api.Tests.Endpoints.Jobs;

public interface IJobApiClient
internal interface IJobApiClient
{
[Get("/jobs/{id}")]
Task<HttpResponseMessage> GetJobById(Guid id);
Expand Down
2 changes: 1 addition & 1 deletion CleanAspCore.Api.Tests/GlobalSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace CleanAspCore.Api.Tests;

[SetUpFixture]
public class GlobalSetup
internal sealed class GlobalSetup
{
internal static IServiceProvider Provider => _serviceProvider;
private static ServiceProvider _serviceProvider = null!;
Expand Down
2 changes: 1 addition & 1 deletion CleanAspCore.Api.Tests/HttpAssertionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace CleanAspCore.Api.Tests;

public static class HttpAssertionExtensions
internal static class HttpAssertionExtensions
{
public static async Task AssertStatusCode(this HttpResponseMessage response, HttpStatusCode expected)
{
Expand Down
2 changes: 1 addition & 1 deletion CleanAspCore.Api.Tests/TestSetup/ClaimConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace CleanAspCore.Api.Tests.TestSetup;

public static class ClaimConstants
internal static class ClaimConstants
{
public static readonly Claim ReadRole = new(ClaimTypes.Role, "read");
public static readonly Claim WriteRole = new(ClaimTypes.Role, "write");
Expand Down
2 changes: 1 addition & 1 deletion CleanAspCore.Api.Tests/TestSetup/DatabasePool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace CleanAspCore.Api.Tests.TestSetup;

public sealed class DatabasePool
internal sealed class DatabasePool
{
private readonly ObjectPool<IDatabase> _pool;

Expand Down
2 changes: 1 addition & 1 deletion CleanAspCore.Api.Tests/TestSetup/DbContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace CleanAspCore.Api.Tests.TestSetup;

public static class DbContextExtensions
internal static class DbContextExtensions
{
public static MigrationScript[] GenerateMigrationScripts(this DbContext context)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace CleanAspCore.Api.Tests.TestSetup;

public sealed class DbContextMigrationInitializer<TDbContext> : IDatabaseInitializer
internal sealed class DbContextMigrationInitializer<TDbContext> : IDatabaseInitializer
where TDbContext : DbContext, new()
{
private int _counter;
Expand Down
Loading

0 comments on commit 0414a3f

Please sign in to comment.