Skip to content

Commit 67e7241

Browse files
committed
refactor: Reformat code for improved readability, adjust client helper visibility, and suppress unused return value warnings.
1 parent 41538ec commit 67e7241

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/BookStore.Client/BookStoreClientExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ public static IServiceCollection AddBookStoreClient(
4343
}
4444

4545
// Helper to register client with standard configuration
46-
private static IHttpClientBuilder AddClient<T>(this IServiceCollection services, Uri baseAddress, Action<IHttpClientBuilder>? configureClient = null) where T : class
46+
static IHttpClientBuilder AddClient<T>(this IServiceCollection services, Uri baseAddress, Action<IHttpClientBuilder>? configureClient = null) where T : class
4747
{
4848
var builder = services.AddRefitClient<T>()
4949
.ConfigureHttpClient(c => c.BaseAddress = baseAddress)
5050
.AddHttpMessageHandler<BookStore.Client.Infrastructure.BookStoreHeaderHandler>()
5151
.AddHttpMessageHandler<BookStore.Client.Infrastructure.BookStoreErrorHandler>();
5252

53-
builder.AddStandardResilienceHandler();
53+
_ = builder.AddStandardResilienceHandler();
5454

5555
configureClient?.Invoke(builder);
5656
return builder;

src/BookStore.Web/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ void AddScopedClient<T>() where T : class => _ = services.AddScoped<T>(sp =>
127127
new BookStore.Client.Infrastructure.BookStoreHeaderHandler() { InnerHandler = networkHandler };
128128
var tenantHandler = new TenantHeaderHandler(tenantService) { InnerHandler = headerHandler };
129129
var authHandler = new AuthorizationMessageHandler(
130-
tokenService, tenantService, httpContextAccessor, correlationService) { InnerHandler = tenantHandler };
130+
tokenService, tenantService, httpContextAccessor, correlationService)
131+
{ InnerHandler = tenantHandler };
131132

132133
// Wrap with resilience handler: Resilience -> Auth -> Tenant -> Network
133134
var resilienceHandler = new ResilienceHandler(resiliencePipeline) { InnerHandler = authHandler };

tests/BookStore.AppHost.Tests/UpdateTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public async Task UpdateAuthor_FullUpdate_ShouldReflectChanges()
2323
Name = $"Updated Author {Guid.NewGuid()}",
2424
Translations = new Dictionary<string, AuthorTranslationDto>
2525
{
26-
["en"] = new("Updated Biography EN"), ["pt-PT"] = new("Biografia Atualizada PT")
26+
["en"] = new("Updated Biography EN"),
27+
["pt-PT"] = new("Biografia Atualizada PT")
2728
}
2829
};
2930

@@ -56,7 +57,8 @@ public async Task UpdateCategory_FullUpdate_ShouldReflectChanges()
5657
{
5758
Translations = new Dictionary<string, CategoryTranslationDto>
5859
{
59-
["en"] = new("Updated Category EN"), ["es"] = new("Categoría Actualizada ES")
60+
["en"] = new("Updated Category EN"),
61+
["es"] = new("Categoría Actualizada ES")
6062
}
6163
};
6264

@@ -137,7 +139,8 @@ public async Task UpdateBook_FullUpdate_ShouldReflectChanges()
137139
Prices = new Dictionary<string, decimal> { ["USD"] = 19.99m },
138140
Translations = new Dictionary<string, BookTranslationDto>
139141
{
140-
["en"] = new("New English Description"), ["pt-PT"] = new("Nova Descrição em Português")
142+
["en"] = new("New English Description"),
143+
["pt-PT"] = new("Nova Descrição em Português")
141144
}
142145
};
143146

0 commit comments

Comments
 (0)