Skip to content

Commit 0606f42

Browse files
committed
refactor: apply consistent code formatting and reorder using statements.
1 parent cfc3468 commit 0606f42

8 files changed

Lines changed: 40 additions & 40 deletions

File tree

src/ApiService/BookStore.ApiService.Tests/ConfigurationValidationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public async Task LocalizationOptions_DefaultCultureEmpty_FailsValidation()
184184
_ = await Assert.That(results.Any(r => r.ErrorMessage!.Contains("DefaultCulture"))).IsTrue();
185185
}
186186

187-
[Test]
187+
[Test]
188188
[Category("Unit")]
189189
public async Task LocalizationOptions_SupportedCulturesEmpty_FailsValidation()
190190
{
@@ -204,7 +204,7 @@ public async Task LocalizationOptions_SupportedCulturesEmpty_FailsValidation()
204204
_ = await Assert.That(results.Any(r => r.ErrorMessage!.Contains("At least one supported culture"))).IsTrue();
205205
}
206206

207-
[Test]
207+
[Test]
208208
[Category("Unit")]
209209
public async Task LocalizationOptions_DefaultCultureNotInSupportedCultures_FailsValidation()
210210
{

src/ApiService/BookStore.ApiService.Tests/Handlers/BookHandlerTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ public async Task CreateBookHandler_ShouldStartStreamWithBookAddedEvent()
3030
[Guid.CreateVersion7()], // AuthorIds
3131
[Guid.CreateVersion7()] // CategoryIds
3232
);
33-
33+
3434
var session = Substitute.For<IDocumentSession>();
3535
_ = session.CorrelationId.Returns("test-correlation-id");
36-
36+
3737
// Act
3838
var result = BookHandlers.Handle(command, session);
39-
39+
4040
// Assert
4141
_ = await Assert.That(result.Item1).IsNotNull();
4242
_ = session.Events.Received(1).StartStream<BookAggregate>(
4343
command.Id,
44-
Arg.Is<BookAdded>(e =>
45-
e.Title == "Clean Code" &&
44+
Arg.Is<BookAdded>(e =>
45+
e.Title == "Clean Code" &&
4646
e.Isbn == "978-0132350884"));
4747
}
48-
48+
4949
[Test]
5050
[Category("Unit")]
5151
public async Task UpdateBookHandler_WithMissingBook_ShouldReturnNotFound()
@@ -62,17 +62,17 @@ public async Task UpdateBookHandler_WithMissingBook_ShouldReturnNotFound()
6262
[], // AuthorIds
6363
[] // CategoryIds
6464
);
65-
65+
6666
var session = Substitute.For<IDocumentSession>();
6767
var context = new DefaultHttpContext();
68-
68+
6969
// Stream doesn't exist
7070
_ = session.Events.FetchStreamStateAsync(command.Id)
7171
.Returns(Task.FromResult<Marten.Events.StreamState?>(null));
72-
72+
7373
// Act
7474
var result = await BookHandlers.Handle(command, session, context);
75-
75+
7676
// Assert
7777
_ = await Assert.That(result).IsTypeOf<Microsoft.AspNetCore.Http.HttpResults.NotFound>();
7878
}

src/ApiService/BookStore.ApiService.Tests/Helpers/BookHelpersTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public async Task IsPreRelease_WithCurrentYearButFutureMonth_ReturnsTrue()
105105
// Arrange
106106
var currentYear = DateTimeOffset.UtcNow.Year;
107107
var currentMonth = DateTimeOffset.UtcNow.Month;
108-
108+
109109
// Skip test if we're in December (no future month available)
110110
if (currentMonth == 12)
111111
{
@@ -128,7 +128,7 @@ public async Task IsPreRelease_WithCurrentYearButPastMonth_ReturnsFalse()
128128
// Arrange
129129
var currentYear = DateTimeOffset.UtcNow.Year;
130130
var currentMonth = DateTimeOffset.UtcNow.Month;
131-
131+
132132
// Skip test if we're in January (no past month available)
133133
if (currentMonth == 1)
134134
{

src/ApiService/BookStore.ApiService.Tests/JsonSerializationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public async Task Properties_Should_Use_CamelCase()
9999
_ = await Assert.That(json).Contains("\"bookTitle\":");
100100
_ = await Assert.That(json).Contains("\"publicationDate\":");
101101
_ = await Assert.That(json).Contains("\"lastModified\":");
102-
102+
103103
// Should NOT contain PascalCase
104104
_ = await Assert.That(json).DoesNotContain("\"BookId\":");
105105
_ = await Assert.That(json).DoesNotContain("\"BookTitle\":");
@@ -126,11 +126,11 @@ public async Task Complex_Object_Should_Follow_All_Standards()
126126
// camelCase properties
127127
_ = await Assert.That(json).Contains("\"bookId\":");
128128
_ = await Assert.That(json).Contains("\"bookTitle\":");
129-
129+
130130
// ISO 8601 dates
131131
_ = await Assert.That(json).Contains("\"publicationDate\":\"2008-08-01\"");
132132
_ = await Assert.That(json).Contains("\"lastModified\":\"2025-12-26T17:16:09+00:00\"");
133-
133+
134134
// Enum as string
135135
_ = await Assert.That(json).Contains("\"status\":\"active\"");
136136
}

src/ApiService/BookStore.ApiService/Infrastructure/Extensions/MartenConfigurationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
using BookStore.ApiService.Projections;
2+
using BookStore.Shared.Infrastructure.Json;
23
using JasperFx.Events;
34
using JasperFx.Events.Projections;
45
using Marten;
56
using Marten.Events.Daemon;
67
using Marten.Events.Projections;
78
using Weasel.Core;
89
using Wolverine.Marten;
9-
using BookStore.Shared.Infrastructure.Json;
1010

1111
namespace BookStore.ApiService.Infrastructure.Extensions;
1212

src/Shared/BookStore.Shared.Tests/PartialDateTests.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public async Task Constructor_WithFullDate_SetsProperties()
4343
[Category("Unit")]
4444
public async Task ValidateYear_ThrowsException_ForInvalidYear()
4545
{
46-
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
46+
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
4747
{
4848
_ = new PartialDate(0);
4949
return Task.CompletedTask;
5050
});
51-
52-
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
51+
52+
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
5353
{
5454
_ = new PartialDate(10000);
5555
return Task.CompletedTask;
@@ -60,13 +60,13 @@ public async Task ValidateYear_ThrowsException_ForInvalidYear()
6060
[Category("Unit")]
6161
public async Task ValidateMonth_ThrowsException_ForInvalidMonth()
6262
{
63-
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
63+
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
6464
{
6565
_ = new PartialDate(2023, 0);
6666
return Task.CompletedTask;
6767
});
68-
69-
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
68+
69+
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
7070
{
7171
_ = new PartialDate(2023, 13);
7272
return Task.CompletedTask;
@@ -89,10 +89,10 @@ public async Task Serialization_WithYearOnly_ReturnsCorrectJson()
8989
{
9090
var date = new PartialDate(2023);
9191
var json = Serialize(date);
92-
92+
9393
using var document = JsonDocument.Parse(json);
9494
var root = document.RootElement;
95-
95+
9696
using var scope = Assert.Multiple();
9797
_ = await Assert.That(root.GetProperty("year").GetInt32()).IsEqualTo(2023);
9898
_ = await Assert.That(root.TryGetProperty("month", out var unusedMonth)).IsFalse();
@@ -105,10 +105,10 @@ public async Task Serialization_WithFullDate_ReturnsCorrectJson()
105105
{
106106
var date = new PartialDate(2023, 5, 15);
107107
var json = Serialize(date);
108-
108+
109109
using var document = JsonDocument.Parse(json);
110110
var root = document.RootElement;
111-
111+
112112
using var scope = Assert.Multiple();
113113
_ = await Assert.That(root.GetProperty("year").GetInt32()).IsEqualTo(2023);
114114
_ = await Assert.That(root.GetProperty("month").GetInt32()).IsEqualTo(5);
@@ -139,21 +139,21 @@ public async Task Deserialization_WithYearOnly_ReturnsCorrectObject()
139139
{
140140
var json = """{"year": 2023, "month": null, "day": null}""";
141141
var date = Deserialize(json);
142-
142+
143143
_ = await Assert.That(date).IsNotNull();
144144
using var scope = Assert.Multiple();
145145
_ = await Assert.That(date!.Value.Year).IsEqualTo(2023);
146146
_ = await Assert.That(date!.Value.Month).IsNull();
147147
_ = await Assert.That(date!.Value.Day).IsNull();
148148
}
149-
149+
150150
[Test]
151151
[Category("Unit")]
152152
public async Task Deserialization_WithPascalCase_ReturnsCorrectObject()
153153
{
154154
var json = """{"Year": 2023, "Month": 5, "Day": 15}""";
155155
var date = Deserialize(json);
156-
156+
157157
_ = await Assert.That(date).IsNotNull();
158158
using var scope = Assert.Multiple();
159159
_ = await Assert.That(date!.Value.Year).IsEqualTo(2023);
@@ -174,12 +174,12 @@ public async Task Deserialization_Null_ReturnsNull()
174174
[Category("Unit")]
175175
public async Task Deserialization_InvalidJson_ThrowsException()
176176
{
177-
var json = """{"year": "invalid"}""";
178-
_ = await Assert.ThrowsAsync<JsonException>(() =>
179-
{
180-
_ = Deserialize(json);
181-
return Task.CompletedTask;
182-
});
177+
var json = """{"year": "invalid"}""";
178+
_ = await Assert.ThrowsAsync<JsonException>(() =>
179+
{
180+
_ = Deserialize(json);
181+
return Task.CompletedTask;
182+
});
183183
}
184184

185185
private string Serialize(PartialDate? date)

src/Web/BookStore.Web/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
using System.Text.Json;
2+
using BookStore.Shared.Infrastructure.Json;
13
using BookStore.Web;
24
using BookStore.Web.Components;
35
using BookStore.Web.Services;
4-
using BookStore.Shared.Infrastructure.Json;
5-
using System.Text.Json;
66
using MudBlazor.Services;
77
using Polly;
88
using Polly.Extensions.Http;

src/Web/BookStore.Web/Services/BookStoreHubService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public async ValueTask DisposeAsync()
7979
{
8080
await _connection.DisposeAsync();
8181
}
82-
82+
8383
_lock.Dispose();
8484
}
8585
}

0 commit comments

Comments
 (0)