From caf3c635611544a2dd0f5096a81c076bcdcfd2a6 Mon Sep 17 00:00:00 2001 From: "Jefferson L. da Silva" Date: Sat, 18 Apr 2026 15:28:26 -0300 Subject: [PATCH 1/2] Updates dependencies and refines API endpoint documentation Updates .NET SDK to 10.0.202 and bumps several NuGet packages, including Microsoft.Extensions and EFCore.BulkExtensions. This change also: - Configures central package management updates in Directory.Packages.props. - Enhances API documentation by adding explicit return types to endpoint `Produces` metadata. - Refactors health check registration into the IoC layer for better separation of concerns. - Updates the .editorconfig to silence async naming warnings in test projects. - Removes the Callstack.ai PR review workflow. --- .editorconfig | 10 +++ .github/workflows/callstack-reviewer.yml | 26 ------ Directory.Packages.props | 70 ++++++++-------- .../Endpoints/InvoiceEndpoints.cs | 6 +- .../Endpoints/JobScheduleEndpoints.cs | 6 +- .../Endpoints/ScanEmailDefinitionEndpoints.cs | 8 +- .../Endpoints/UserEndpoints.cs | 6 +- .../InvoiceReminder.API.csproj | 1 - InvoiceReminder.API/InvoiceReminder.http | 83 +++++++++---------- InvoiceReminder.API/Program.cs | 35 +++----- InvoiceReminder.API/appsettings.json | 3 +- .../AppServices/UserAppService.cs | 2 +- .../InvoiceReminder.ArchitectureTests.csproj | 2 +- .../DependencyInjectionConfig.cs | 27 +++++- .../InvoiceReminder.CrossCutting.IoC.csproj | 3 +- .../InvoiceReminder.Data.csproj | 4 +- .../InvoiceReminder.IntegrationTests.csproj | 2 +- .../InvoiceReminder.UnitTests.API.csproj | 2 +- .../AppServices/UserAppServiceTests.cs | 2 +- ...voiceReminder.UnitTests.Application.csproj | 2 +- .../InvoiceReminder.UnitTests.Domain.csproj | 2 +- ...Reminder.UnitTests.ExternalServices.csproj | 2 +- ...ceReminder.UnitTests.Infrastructure.csproj | 2 +- ...oiceReminder.UnitTests.JobScheduler.csproj | 2 +- global.json | 2 +- 25 files changed, 146 insertions(+), 164 deletions(-) delete mode 100644 .github/workflows/callstack-reviewer.yml diff --git a/.editorconfig b/.editorconfig index 31931b5..222a736 100644 --- a/.editorconfig +++ b/.editorconfig @@ -215,6 +215,16 @@ dotnet_naming_symbols.async_methods.required_modifiers = async dotnet_naming_style.end_in_async.required_suffix = Async dotnet_naming_style.end_in_async.capitalization = pascal_case +# Async Naming Rules Exceptions +[*ArchitectureTests/**/*.cs] +dotnet_naming_rule.async_methods_end_in_async.severity = silent + +[*IntegrationTests/**/*.cs] +dotnet_naming_rule.async_methods_end_in_async.severity = silent + +[*UnitTests*/**/*.cs] +dotnet_naming_rule.async_methods_end_in_async.severity = silent + # Symbol specifications dotnet_naming_symbols.interface.applicable_kinds = interface diff --git a/.github/workflows/callstack-reviewer.yml b/.github/workflows/callstack-reviewer.yml deleted file mode 100644 index f08982f..0000000 --- a/.github/workflows/callstack-reviewer.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Callstack.ai PR Review - -permissions: - contents: read - -on: - workflow_dispatch: - inputs: - config: - type: string - description: "config for reviewer" - required: true - head: - type: string - description: "head commit sha" - required: true - -jobs: - callstack_pr_review_job: - runs-on: ubuntu-latest - steps: - - name: Review PR - uses: callstackai/action@main - with: - config: ${{ inputs.config }} - head: ${{ inputs.head }} \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index e708603..8495e6b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,66 +5,66 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - + + - - - + + + - + - - + + - - - + + + - + - + - - - + + + diff --git a/InvoiceReminder.API/Endpoints/InvoiceEndpoints.cs b/InvoiceReminder.API/Endpoints/InvoiceEndpoints.cs index f4b8a94..aa52e12 100644 --- a/InvoiceReminder.API/Endpoints/InvoiceEndpoints.cs +++ b/InvoiceReminder.API/Endpoints/InvoiceEndpoints.cs @@ -32,7 +32,7 @@ private static void MapGetInvoices(RouteGroupBuilder endpoint) }) .WithName("GetInvoices") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces>(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status500InternalServerError); @@ -50,7 +50,7 @@ private static void MapGetInvoice(RouteGroupBuilder endpoint) }) .WithName("GetInvoice") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) @@ -70,7 +70,7 @@ private static void MapGetInvoiceByBarcode(RouteGroupBuilder endpoint) }) .WithName("GetInvoiceByBarcode") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) diff --git a/InvoiceReminder.API/Endpoints/JobScheduleEndpoints.cs b/InvoiceReminder.API/Endpoints/JobScheduleEndpoints.cs index 10e9199..a3452a7 100644 --- a/InvoiceReminder.API/Endpoints/JobScheduleEndpoints.cs +++ b/InvoiceReminder.API/Endpoints/JobScheduleEndpoints.cs @@ -32,7 +32,7 @@ private static void MapGetJobSchedules(RouteGroupBuilder endpoint) }) .WithName("GetJobSchedules") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces>(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status500InternalServerError); @@ -51,7 +51,7 @@ private static void MapGetJobSchedule(RouteGroupBuilder endpoint) }) .WithName("GetJobSchedule") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) @@ -71,7 +71,7 @@ private static void MapGetJobScheduleByUserId(RouteGroupBuilder endpoint) }) .WithName("GetJobScheduleByUserId") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces>(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) diff --git a/InvoiceReminder.API/Endpoints/ScanEmailDefinitionEndpoints.cs b/InvoiceReminder.API/Endpoints/ScanEmailDefinitionEndpoints.cs index bd65d6c..df43b79 100644 --- a/InvoiceReminder.API/Endpoints/ScanEmailDefinitionEndpoints.cs +++ b/InvoiceReminder.API/Endpoints/ScanEmailDefinitionEndpoints.cs @@ -33,7 +33,7 @@ private static void MapGetScanEmailDefinitions(RouteGroupBuilder endpoint) }) .WithName("GetScanEmailDefinitions") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces>(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status500InternalServerError); @@ -52,7 +52,7 @@ private static void MapGetScanEmailDefinition(RouteGroupBuilder endpoint) }) .WithName("GetScanEmailDefinition") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) @@ -72,7 +72,7 @@ private static void MapGetByUserId(RouteGroupBuilder endpoint) }) .WithName("GetByUserId") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces>(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) @@ -92,7 +92,7 @@ private static void MapGetBySenderEmailAddress(RouteGroupBuilder endpoint) }) .WithName("GetBySenderEmailAddress") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces>(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) diff --git a/InvoiceReminder.API/Endpoints/UserEndpoints.cs b/InvoiceReminder.API/Endpoints/UserEndpoints.cs index 3b0985d..bbba0f6 100644 --- a/InvoiceReminder.API/Endpoints/UserEndpoints.cs +++ b/InvoiceReminder.API/Endpoints/UserEndpoints.cs @@ -34,7 +34,7 @@ private static void MapGetUsers(RouteGroupBuilder endpoint) }) .WithName("GetUsers") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces>(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status500InternalServerError); @@ -52,7 +52,7 @@ private static void MapGetUser(RouteGroupBuilder endpoint) }) .WithName("GetUser") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) @@ -72,7 +72,7 @@ private static void MapGetUserByEmail(RouteGroupBuilder endpoint) }) .WithName("GetUserByEmail") .RequireAuthorization() - .Produces(StatusCodes.Status200OK) + .Produces(StatusCodes.Status200OK) .Produces(StatusCodes.Status400BadRequest) .Produces(StatusCodes.Status401Unauthorized) .Produces(StatusCodes.Status404NotFound) diff --git a/InvoiceReminder.API/InvoiceReminder.API.csproj b/InvoiceReminder.API/InvoiceReminder.API.csproj index 2ac0a6d..2d484ac 100644 --- a/InvoiceReminder.API/InvoiceReminder.API.csproj +++ b/InvoiceReminder.API/InvoiceReminder.API.csproj @@ -11,7 +11,6 @@ - diff --git a/InvoiceReminder.API/InvoiceReminder.http b/InvoiceReminder.API/InvoiceReminder.http index c6e20d9..4ba14cb 100644 --- a/InvoiceReminder.API/InvoiceReminder.http +++ b/InvoiceReminder.API/InvoiceReminder.http @@ -41,15 +41,14 @@ Authorization: Bearer your_jwt_token_here ### Create User POST {{InvoiceReminder_HostAddress}}/api/user Content-Type: application/json -Authorization: Bearer your_jwt_token_here { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "João Silva", "email": "joao@example.com", - "password": "password123", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "userPassword": { + "passwordHash": "123456" + } } ### @@ -64,17 +63,17 @@ Authorization: Bearer your_jwt_token_here "id": "550e8400-e29b-41d4-a716-446655440000", "name": "João Silva", "email": "joao@example.com", - "password": "password123", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "userPassword": { + "passwordHash": "123456" + } }, { "id": "550e8400-e29b-41d4-a716-446655440001", "name": "Maria Santos", "email": "maria@example.com", - "password": "password123", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "userPassword": { + "passwordHash": "123456" + } } ] @@ -89,9 +88,22 @@ Authorization: Bearer your_jwt_token_here "id": "550e8400-e29b-41d4-a716-446655440000", "name": "João Silva Updated", "email": "joao.updated@example.com", - "password": "newpassword123", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "userPassword": { + "passwordHash": "newPassword123456" + } +} + +### + +### Update Basic User Info +PATCH {{InvoiceReminder_HostAddress}}/api/user +Content-Type: application/json +Authorization: Bearer your_jwt_token_here + +{ + "id": "550e8400-e29b-41d4-a716-446655440000", + "name": "João Silva Updated", + "email": "joao.updated@example.com" } ### @@ -104,10 +116,7 @@ Authorization: Bearer your_jwt_token_here { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "João Silva", - "email": "joao@example.com", - "password": "password123", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "email": "joao@example.com" } ### @@ -131,7 +140,7 @@ Authorization: Bearer your_jwt_token_here ### ### Get Invoice by Barcode -GET {{InvoiceReminder_HostAddress}}/api/invoice/getby-barcode/12345678901234567890123456789012345678901234 +GET {{InvoiceReminder_HostAddress}}/api/invoice/getby-barcode/12345678901234567890123456789012345678901244 Accept: application/json Authorization: Bearer your_jwt_token_here @@ -147,10 +156,8 @@ Authorization: Bearer your_jwt_token_here "bank": "Banco do Brasil", "beneficiary": "João da Silva", "amount": 100.00, - "barcode": "12345678901234567890123456789012345678901234", - "dueDate": "2025-12-25T00:00:00Z", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "barcode": "12345678901234567890123456789012345678901244", + "dueDate": "2025-12-25T00:00:00Z" } ### @@ -167,8 +174,6 @@ Authorization: Bearer your_jwt_token_here "amount": 150.00, "barcode": "12345678901234567890123456789012345678901244", "dueDate": "2025-12-25T00:00:00Z", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" } ### @@ -184,9 +189,7 @@ Authorization: Bearer your_jwt_token_here "beneficiary": "João da Silva", "amount": 100.00, "barcode": "12345678901234567890123456789012345678901244", - "dueDate": "2025-12-25T00:00:00Z", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "dueDate": "2025-12-25T00:00:00Z" } ### @@ -224,9 +227,7 @@ Authorization: Bearer your_jwt_token_here { "id": "550e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", - "cronExpression": "0 0 * * *", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "cronExpression": "0 0 * * *" } ### @@ -239,9 +240,7 @@ Authorization: Bearer your_jwt_token_here { "id": "550e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", - "cronExpression": "0 0 * * 1", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "cronExpression": "0 0 * * 1" } ### @@ -254,9 +253,7 @@ Authorization: Bearer your_jwt_token_here { "id": "550e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", - "cronExpression": "0 0 * * *", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "cronExpression": "0 0 * * *" } ### @@ -287,7 +284,7 @@ Authorization: Bearer your_jwt_token_here ### ### Get Scan Email Definition by Sender Email Address -GET {{InvoiceReminder_HostAddress}}/api/scan_email/sender@example.com/550e8400-e29b-41d4-a716-446655440000 +GET {{InvoiceReminder_HostAddress}}/api/scan_email/getby-sender/sender@example.com/550e8400-e29b-41d4-a716-446655440000 Accept: application/json Authorization: Bearer your_jwt_token_here @@ -301,9 +298,7 @@ Authorization: Bearer your_jwt_token_here { "id": "550e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", - "senderEmailAddress": "sender@example.com", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "senderEmailAddress": "sender@example.com" } ### @@ -316,9 +311,7 @@ Authorization: Bearer your_jwt_token_here { "id": "550e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", - "senderEmailAddress": "newemail@example.com", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "senderEmailAddress": "newemail@example.com" } ### @@ -331,9 +324,7 @@ Authorization: Bearer your_jwt_token_here { "id": "550e8400-e29b-41d4-a716-446655440000", "userId": "550e8400-e29b-41d4-a716-446655440000", - "senderEmailAddress": "sender@example.com", - "createdAt": "2025-11-25T00:00:00Z", - "updatedAt": "2025-11-25T00:00:00Z" + "senderEmailAddress": "sender@example.com" } ### diff --git a/InvoiceReminder.API/Program.cs b/InvoiceReminder.API/Program.cs index 1df8d5c..9e054fc 100644 --- a/InvoiceReminder.API/Program.cs +++ b/InvoiceReminder.API/Program.cs @@ -1,7 +1,6 @@ using InvoiceReminder.API.AuthenticationSetup; using InvoiceReminder.API.Extensions; using InvoiceReminder.CrossCutting.IoC; -using Microsoft.Extensions.Diagnostics.HealthChecks; using Scalar.AspNetCore; var builder = WebApplication.CreateBuilder(args); @@ -11,33 +10,21 @@ builder.Services.AddExceptionHandler(); builder.Services.AddInfrastructure(); builder.Services.AddOpenApi(opt => opt.AddDocumentTransformer()); - +builder.Services.ConfigureOptions(); +builder.Services.ConfigureOptions(); builder.Services.AddCors(opt => opt.AddPolicy("CorsPolicy", policy => - { - var allowedOrigins = builder.Configuration.GetSection("Cors:AllowedOrigins").Get() ?? []; - - _ = policy - .AllowAnyMethod() - .AllowCredentials() - .WithOrigins(allowedOrigins) - .WithHeaders("Content-Type", "Authorization"); - } - ) + { + var allowedOrigins = builder.Configuration.GetSection("Cors:AllowedOrigins").Get() ?? []; + + _ = policy + .AllowAnyMethod() + .AllowCredentials() + .WithOrigins(allowedOrigins) + .WithHeaders("Content-Type", "Authorization"); + }) ); -builder.Services.AddHealthChecks().AddNpgSql -( - connectionString: builder.Configuration.GetConnectionString("DataBaseConnection"), - name: "postgres", - healthQuery: "SELECT 1;", - tags: ["db", "sql", "critical"], - failureStatus: HealthStatus.Unhealthy -); - -builder.Services.ConfigureOptions(); -builder.Services.ConfigureOptions(); - var app = builder.Build(); if (app.Environment.IsDevelopment()) diff --git a/InvoiceReminder.API/appsettings.json b/InvoiceReminder.API/appsettings.json index 37ff50a..6c296fc 100644 --- a/InvoiceReminder.API/appsettings.json +++ b/InvoiceReminder.API/appsettings.json @@ -2,7 +2,8 @@ "Logging": { "LogLevel": { "Default": "Information", - "Microsoft.AspNetCore": "Warning" + "Microsoft": "Information", + "Microsoft.AspNetCore": "Information" } }, "AllowedHosts": "*", diff --git a/InvoiceReminder.Application/AppServices/UserAppService.cs b/InvoiceReminder.Application/AppServices/UserAppService.cs index 2c3c996..905d219 100644 --- a/InvoiceReminder.Application/AppServices/UserAppService.cs +++ b/InvoiceReminder.Application/AppServices/UserAppService.cs @@ -89,6 +89,6 @@ public async Task> UpdateBasicUserInfoAsync( return result ? Result.Success(viewModel) - : Result.Failure("User not Found!"); + : Result.Failure("Failure on updating User"); } } diff --git a/InvoiceReminder.ArchitectureTests/InvoiceReminder.ArchitectureTests.csproj b/InvoiceReminder.ArchitectureTests/InvoiceReminder.ArchitectureTests.csproj index 803b79a..30650f7 100644 --- a/InvoiceReminder.ArchitectureTests/InvoiceReminder.ArchitectureTests.csproj +++ b/InvoiceReminder.ArchitectureTests/InvoiceReminder.ArchitectureTests.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs b/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs index c3fbfab..0f9bca7 100644 --- a/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs +++ b/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs @@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Diagnostics.HealthChecks; using Quartz; using Quartz.Impl; using Quartz.Spi; @@ -35,12 +36,13 @@ public static IServiceCollection AddInfrastructure(this IServiceCollection servi _ = services.AddHostedService(); - _ = services.AddAppServices() - .AddDbContext() + _ = services.AddDbContext() + .AddRepositories() + .AddAppServices() .AddExternalServices() .AddQuartzJobService() - .AddRepositories() - .AddScheduledJobs(); + .AddScheduledJobs() + .AddHealthCheck(); return services; } @@ -98,6 +100,23 @@ private static IServiceCollection AddExternalServices(this IServiceCollection se return services; } + private static IServiceCollection AddHealthCheck(this IServiceCollection services) + { + using var scope = services.BuildServiceProvider().CreateScope(); + var configuration = scope.ServiceProvider.GetRequiredService(); + + _ = services.AddHealthChecks().AddNpgSql + ( + connectionString: configuration.GetConnectionString("DataBaseConnection"), + name: "postgres", + healthQuery: "SELECT 1;", + tags: ["db", "sql", "critical"], + failureStatus: HealthStatus.Unhealthy + ); + + return services; + } + private static IServiceCollection AddQuartzJobService(this IServiceCollection services) { _ = services.AddHostedService(); diff --git a/InvoiceReminder.CrossCutting.IoC/InvoiceReminder.CrossCutting.IoC.csproj b/InvoiceReminder.CrossCutting.IoC/InvoiceReminder.CrossCutting.IoC.csproj index 0d983da..6dc89e7 100644 --- a/InvoiceReminder.CrossCutting.IoC/InvoiceReminder.CrossCutting.IoC.csproj +++ b/InvoiceReminder.CrossCutting.IoC/InvoiceReminder.CrossCutting.IoC.csproj @@ -1,4 +1,4 @@ - + @@ -9,6 +9,7 @@ + diff --git a/InvoiceReminder.Data/InvoiceReminder.Data.csproj b/InvoiceReminder.Data/InvoiceReminder.Data.csproj index b35eebb..2a44f9a 100644 --- a/InvoiceReminder.Data/InvoiceReminder.Data.csproj +++ b/InvoiceReminder.Data/InvoiceReminder.Data.csproj @@ -6,8 +6,8 @@ - - + + diff --git a/InvoiceReminder.IntegrationTests/InvoiceReminder.IntegrationTests.csproj b/InvoiceReminder.IntegrationTests/InvoiceReminder.IntegrationTests.csproj index 9e79e2e..51953cb 100644 --- a/InvoiceReminder.IntegrationTests/InvoiceReminder.IntegrationTests.csproj +++ b/InvoiceReminder.IntegrationTests/InvoiceReminder.IntegrationTests.csproj @@ -1,4 +1,4 @@ - + CA1873 diff --git a/InvoiceReminder.UnitTests.API/InvoiceReminder.UnitTests.API.csproj b/InvoiceReminder.UnitTests.API/InvoiceReminder.UnitTests.API.csproj index 298ec50..a4acda3 100644 --- a/InvoiceReminder.UnitTests.API/InvoiceReminder.UnitTests.API.csproj +++ b/InvoiceReminder.UnitTests.API/InvoiceReminder.UnitTests.API.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.UnitTests.Application/AppServices/UserAppServiceTests.cs b/InvoiceReminder.UnitTests.Application/AppServices/UserAppServiceTests.cs index 84c8fdb..c538d57 100644 --- a/InvoiceReminder.UnitTests.Application/AppServices/UserAppServiceTests.cs +++ b/InvoiceReminder.UnitTests.Application/AppServices/UserAppServiceTests.cs @@ -182,7 +182,7 @@ public async Task UpdateBasicUserInfoAsync_WhenUserNotFound_ShouldReturnFailure( _ = result.ShouldNotBeNull(); result.Value.ShouldBeNull(); result.Error.ShouldNotBeNullOrEmpty(); - result.Error.ShouldBe("User not Found!"); + result.Error.ShouldBe("Failure on updating User"); }); } } diff --git a/InvoiceReminder.UnitTests.Application/InvoiceReminder.UnitTests.Application.csproj b/InvoiceReminder.UnitTests.Application/InvoiceReminder.UnitTests.Application.csproj index 199d191..f7563b5 100644 --- a/InvoiceReminder.UnitTests.Application/InvoiceReminder.UnitTests.Application.csproj +++ b/InvoiceReminder.UnitTests.Application/InvoiceReminder.UnitTests.Application.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.UnitTests.Domain/InvoiceReminder.UnitTests.Domain.csproj b/InvoiceReminder.UnitTests.Domain/InvoiceReminder.UnitTests.Domain.csproj index f1eced2..4699361 100644 --- a/InvoiceReminder.UnitTests.Domain/InvoiceReminder.UnitTests.Domain.csproj +++ b/InvoiceReminder.UnitTests.Domain/InvoiceReminder.UnitTests.Domain.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.UnitTests.ExternalServices/InvoiceReminder.UnitTests.ExternalServices.csproj b/InvoiceReminder.UnitTests.ExternalServices/InvoiceReminder.UnitTests.ExternalServices.csproj index 271ba4a..3aaad77 100644 --- a/InvoiceReminder.UnitTests.ExternalServices/InvoiceReminder.UnitTests.ExternalServices.csproj +++ b/InvoiceReminder.UnitTests.ExternalServices/InvoiceReminder.UnitTests.ExternalServices.csproj @@ -1,4 +1,4 @@ - + CA1873 diff --git a/InvoiceReminder.UnitTests.Infrastructure/InvoiceReminder.UnitTests.Infrastructure.csproj b/InvoiceReminder.UnitTests.Infrastructure/InvoiceReminder.UnitTests.Infrastructure.csproj index f7a5494..3931698 100644 --- a/InvoiceReminder.UnitTests.Infrastructure/InvoiceReminder.UnitTests.Infrastructure.csproj +++ b/InvoiceReminder.UnitTests.Infrastructure/InvoiceReminder.UnitTests.Infrastructure.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.UnitTests.JobScheduler/InvoiceReminder.UnitTests.JobScheduler.csproj b/InvoiceReminder.UnitTests.JobScheduler/InvoiceReminder.UnitTests.JobScheduler.csproj index 2a4b76c..49b4417 100644 --- a/InvoiceReminder.UnitTests.JobScheduler/InvoiceReminder.UnitTests.JobScheduler.csproj +++ b/InvoiceReminder.UnitTests.JobScheduler/InvoiceReminder.UnitTests.JobScheduler.csproj @@ -1,4 +1,4 @@ - + CA1873 diff --git a/global.json b/global.json index c5c2593..660bd86 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.201" + "version": "10.0.202" }, "test": { "runner": "Microsoft.Testing.Platform" From 8ab0786ff4f1268a2d58ac6243368800ed4bfa5f Mon Sep 17 00:00:00 2001 From: "Jefferson L. da Silva" Date: Sat, 18 Apr 2026 16:06:17 -0300 Subject: [PATCH 2/2] Centralizes MSTest.Sdk versioning and refines health check registration Moves the MSTest.Sdk version to global.json to manage it centrally across all test projects. Additionally, refactors the health check registration in DependencyInjectionConfig to use a connection string factory. This avoids building the service provider during the service registration phase, preventing potential side effects and performance issues. --- .../InvoiceReminder.ArchitectureTests.csproj | 2 +- .../DependencyInjectionConfig.cs | 6 ++---- .../InvoiceReminder.IntegrationTests.csproj | 2 +- .../InvoiceReminder.UnitTests.API.csproj | 2 +- .../InvoiceReminder.UnitTests.Application.csproj | 2 +- .../InvoiceReminder.UnitTests.Domain.csproj | 2 +- .../InvoiceReminder.UnitTests.ExternalServices.csproj | 2 +- .../InvoiceReminder.UnitTests.Infrastructure.csproj | 2 +- .../InvoiceReminder.UnitTests.JobScheduler.csproj | 2 +- global.json | 3 +++ 10 files changed, 13 insertions(+), 12 deletions(-) diff --git a/InvoiceReminder.ArchitectureTests/InvoiceReminder.ArchitectureTests.csproj b/InvoiceReminder.ArchitectureTests/InvoiceReminder.ArchitectureTests.csproj index 30650f7..eef0c92 100644 --- a/InvoiceReminder.ArchitectureTests/InvoiceReminder.ArchitectureTests.csproj +++ b/InvoiceReminder.ArchitectureTests/InvoiceReminder.ArchitectureTests.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs b/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs index 0f9bca7..597515e 100644 --- a/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs +++ b/InvoiceReminder.CrossCutting.IoC/DependencyInjectionConfig.cs @@ -102,12 +102,10 @@ private static IServiceCollection AddExternalServices(this IServiceCollection se private static IServiceCollection AddHealthCheck(this IServiceCollection services) { - using var scope = services.BuildServiceProvider().CreateScope(); - var configuration = scope.ServiceProvider.GetRequiredService(); - _ = services.AddHealthChecks().AddNpgSql ( - connectionString: configuration.GetConnectionString("DataBaseConnection"), + connectionStringFactory: sp => sp.GetRequiredService() + .GetConnectionString("DatabaseConnection"), name: "postgres", healthQuery: "SELECT 1;", tags: ["db", "sql", "critical"], diff --git a/InvoiceReminder.IntegrationTests/InvoiceReminder.IntegrationTests.csproj b/InvoiceReminder.IntegrationTests/InvoiceReminder.IntegrationTests.csproj index 51953cb..6b89eeb 100644 --- a/InvoiceReminder.IntegrationTests/InvoiceReminder.IntegrationTests.csproj +++ b/InvoiceReminder.IntegrationTests/InvoiceReminder.IntegrationTests.csproj @@ -1,4 +1,4 @@ - + CA1873 diff --git a/InvoiceReminder.UnitTests.API/InvoiceReminder.UnitTests.API.csproj b/InvoiceReminder.UnitTests.API/InvoiceReminder.UnitTests.API.csproj index a4acda3..05dbcf3 100644 --- a/InvoiceReminder.UnitTests.API/InvoiceReminder.UnitTests.API.csproj +++ b/InvoiceReminder.UnitTests.API/InvoiceReminder.UnitTests.API.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.UnitTests.Application/InvoiceReminder.UnitTests.Application.csproj b/InvoiceReminder.UnitTests.Application/InvoiceReminder.UnitTests.Application.csproj index f7563b5..2c83bec 100644 --- a/InvoiceReminder.UnitTests.Application/InvoiceReminder.UnitTests.Application.csproj +++ b/InvoiceReminder.UnitTests.Application/InvoiceReminder.UnitTests.Application.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.UnitTests.Domain/InvoiceReminder.UnitTests.Domain.csproj b/InvoiceReminder.UnitTests.Domain/InvoiceReminder.UnitTests.Domain.csproj index 4699361..d755811 100644 --- a/InvoiceReminder.UnitTests.Domain/InvoiceReminder.UnitTests.Domain.csproj +++ b/InvoiceReminder.UnitTests.Domain/InvoiceReminder.UnitTests.Domain.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.UnitTests.ExternalServices/InvoiceReminder.UnitTests.ExternalServices.csproj b/InvoiceReminder.UnitTests.ExternalServices/InvoiceReminder.UnitTests.ExternalServices.csproj index 3aaad77..46bca07 100644 --- a/InvoiceReminder.UnitTests.ExternalServices/InvoiceReminder.UnitTests.ExternalServices.csproj +++ b/InvoiceReminder.UnitTests.ExternalServices/InvoiceReminder.UnitTests.ExternalServices.csproj @@ -1,4 +1,4 @@ - + CA1873 diff --git a/InvoiceReminder.UnitTests.Infrastructure/InvoiceReminder.UnitTests.Infrastructure.csproj b/InvoiceReminder.UnitTests.Infrastructure/InvoiceReminder.UnitTests.Infrastructure.csproj index 3931698..f72f69d 100644 --- a/InvoiceReminder.UnitTests.Infrastructure/InvoiceReminder.UnitTests.Infrastructure.csproj +++ b/InvoiceReminder.UnitTests.Infrastructure/InvoiceReminder.UnitTests.Infrastructure.csproj @@ -1,4 +1,4 @@ - + true diff --git a/InvoiceReminder.UnitTests.JobScheduler/InvoiceReminder.UnitTests.JobScheduler.csproj b/InvoiceReminder.UnitTests.JobScheduler/InvoiceReminder.UnitTests.JobScheduler.csproj index 49b4417..1764707 100644 --- a/InvoiceReminder.UnitTests.JobScheduler/InvoiceReminder.UnitTests.JobScheduler.csproj +++ b/InvoiceReminder.UnitTests.JobScheduler/InvoiceReminder.UnitTests.JobScheduler.csproj @@ -1,4 +1,4 @@ - + CA1873 diff --git a/global.json b/global.json index 660bd86..8f01b00 100644 --- a/global.json +++ b/global.json @@ -2,6 +2,9 @@ "sdk": { "version": "10.0.202" }, + "msbuild-sdks": { + "MSTest.Sdk": "4.2.1" + }, "test": { "runner": "Microsoft.Testing.Platform" }