From 0c55d6c83fc101de660e8d6ba1934e628df69b9f Mon Sep 17 00:00:00 2001 From: Aaron Po Date: Sat, 20 Jun 2026 15:09:42 -0400 Subject: [PATCH] Format ./web/backend/Features/Features.Breweries.Tests --- .../Commands/CreateBreweryHandlerTests.cs | 17 +++---------- .../Commands/DeleteBreweryHandlerTests.cs | 2 +- .../Commands/UpdateBreweryHandlerTests.cs | 6 +++-- .../Features.Breweries.Tests.csproj | 16 ++++++------ .../Queries/GetAllBreweriesHandlerTests.cs | 25 ++++++++++++------- .../Queries/GetBreweryByIdHandlerTests.cs | 18 +++++++------ .../Repository/BreweryRepositoryTests.cs | 9 +++---- .../Repository/TestConnectionFactory.cs | 2 +- 8 files changed, 48 insertions(+), 47 deletions(-) diff --git a/web/backend/Features/Features.Breweries.Tests/Commands/CreateBreweryHandlerTests.cs b/web/backend/Features/Features.Breweries.Tests/Commands/CreateBreweryHandlerTests.cs index 6bbf7b4..f1bfdb2 100644 --- a/web/backend/Features/Features.Breweries.Tests/Commands/CreateBreweryHandlerTests.cs +++ b/web/backend/Features/Features.Breweries.Tests/Commands/CreateBreweryHandlerTests.cs @@ -19,24 +19,13 @@ public class CreateBreweryHandlerTests private static CreateBreweryLocation ValidLocation() { - return new CreateBreweryLocation( - Guid.NewGuid(), - "123 Main St", - null, - "12345", - null - ); + return new CreateBreweryLocation(Guid.NewGuid(), "123 Main St", null, "12345", null); } [Fact] public async Task Handle_PersistsEntity_WithNewIdsAndCreatedAt() { - CreateBreweryCommand command = new( - Guid.NewGuid(), - "MyBrew", - "Desc", - ValidLocation() - ); + CreateBreweryCommand command = new(Guid.NewGuid(), "MyBrew", "Desc", ValidLocation()); BreweryPost? persisted = null; _repoMock @@ -68,4 +57,4 @@ public class CreateBreweryHandlerTests result.BreweryName.Should().Be("MyBrew"); result.Location.Should().NotBeNull(); } -} \ No newline at end of file +} diff --git a/web/backend/Features/Features.Breweries.Tests/Commands/DeleteBreweryHandlerTests.cs b/web/backend/Features/Features.Breweries.Tests/Commands/DeleteBreweryHandlerTests.cs index 243ca81..39736f6 100644 --- a/web/backend/Features/Features.Breweries.Tests/Commands/DeleteBreweryHandlerTests.cs +++ b/web/backend/Features/Features.Breweries.Tests/Commands/DeleteBreweryHandlerTests.cs @@ -18,4 +18,4 @@ public class DeleteBreweryHandlerTests repoMock.Verify(r => r.DeleteAsync(id), Times.Once); } -} \ No newline at end of file +} diff --git a/web/backend/Features/Features.Breweries.Tests/Commands/UpdateBreweryHandlerTests.cs b/web/backend/Features/Features.Breweries.Tests/Commands/UpdateBreweryHandlerTests.cs index 0299612..c087198 100644 --- a/web/backend/Features/Features.Breweries.Tests/Commands/UpdateBreweryHandlerTests.cs +++ b/web/backend/Features/Features.Breweries.Tests/Commands/UpdateBreweryHandlerTests.cs @@ -96,11 +96,13 @@ public class UpdateBreweryHandlerTests await _handler.Handle(command, CancellationToken.None); persisted!.Location.Should().NotBeNull(); - persisted.Location!.BreweryPostLocationId.Should().Be(locationCommand.BreweryPostLocationId); + persisted + .Location!.BreweryPostLocationId.Should() + .Be(locationCommand.BreweryPostLocationId); persisted.Location.BreweryPostId.Should().Be(command.BreweryPostId); persisted.Location.CityId.Should().Be(locationCommand.CityId); persisted.Location.AddressLine1.Should().Be(locationCommand.AddressLine1); persisted.Location.AddressLine2.Should().Be(locationCommand.AddressLine2); persisted.Location.PostalCode.Should().Be(locationCommand.PostalCode); } -} \ No newline at end of file +} diff --git a/web/backend/Features/Features.Breweries.Tests/Features.Breweries.Tests.csproj b/web/backend/Features/Features.Breweries.Tests/Features.Breweries.Tests.csproj index 7ddeb83..e97da60 100644 --- a/web/backend/Features/Features.Breweries.Tests/Features.Breweries.Tests.csproj +++ b/web/backend/Features/Features.Breweries.Tests/Features.Breweries.Tests.csproj @@ -8,19 +8,19 @@ - - - - - - + + + + + + - + - + diff --git a/web/backend/Features/Features.Breweries.Tests/Queries/GetAllBreweriesHandlerTests.cs b/web/backend/Features/Features.Breweries.Tests/Queries/GetAllBreweriesHandlerTests.cs index 5a0478d..32a4459 100644 --- a/web/backend/Features/Features.Breweries.Tests/Queries/GetAllBreweriesHandlerTests.cs +++ b/web/backend/Features/Features.Breweries.Tests/Queries/GetAllBreweriesHandlerTests.cs @@ -20,10 +20,12 @@ public class GetAllBreweriesHandlerTests [Fact] public async Task Handle_PassesLimitAndOffset_ToRepository() { - _repoMock.Setup(r => r.GetAllAsync(10, 5)) - .ReturnsAsync(Array.Empty()); + _repoMock.Setup(r => r.GetAllAsync(10, 5)).ReturnsAsync(Array.Empty()); - IEnumerable result = await _handler.Handle(new GetAllBreweriesQuery(10, 5), CancellationToken.None); + IEnumerable result = await _handler.Handle( + new GetAllBreweriesQuery(10, 5), + CancellationToken.None + ); result.Should().BeEmpty(); _repoMock.Verify(r => r.GetAllAsync(10, 5), Times.Once); @@ -35,13 +37,18 @@ public class GetAllBreweriesHandlerTests BreweryPost[] breweries = new[] { new BreweryPost { BreweryPostId = Guid.NewGuid(), BreweryName = "A" }, - new BreweryPost { BreweryPostId = Guid.NewGuid(), BreweryName = "B" } + new BreweryPost { BreweryPostId = Guid.NewGuid(), BreweryName = "B" }, }; - _repoMock.Setup(r => r.GetAllAsync(null, null)) - .ReturnsAsync(breweries); + _repoMock.Setup(r => r.GetAllAsync(null, null)).ReturnsAsync(breweries); - IEnumerable result = await _handler.Handle(new GetAllBreweriesQuery(null, null), CancellationToken.None); + IEnumerable result = await _handler.Handle( + new GetAllBreweriesQuery(null, null), + CancellationToken.None + ); - result.Select(b => b.BreweryPostId).Should().BeEquivalentTo(breweries.Select(b => b.BreweryPostId)); + result + .Select(b => b.BreweryPostId) + .Should() + .BeEquivalentTo(breweries.Select(b => b.BreweryPostId)); } -} \ No newline at end of file +} diff --git a/web/backend/Features/Features.Breweries.Tests/Queries/GetBreweryByIdHandlerTests.cs b/web/backend/Features/Features.Breweries.Tests/Queries/GetBreweryByIdHandlerTests.cs index be453ef..de29911 100644 --- a/web/backend/Features/Features.Breweries.Tests/Queries/GetBreweryByIdHandlerTests.cs +++ b/web/backend/Features/Features.Breweries.Tests/Queries/GetBreweryByIdHandlerTests.cs @@ -21,10 +21,12 @@ public class GetBreweryByIdHandlerTests public async Task Handle_ReturnsBrewery_WhenFound() { BreweryPost brewery = new() { BreweryPostId = Guid.NewGuid(), BreweryName = "Test" }; - _repoMock.Setup(r => r.GetByIdAsync(brewery.BreweryPostId)) - .ReturnsAsync(brewery); + _repoMock.Setup(r => r.GetByIdAsync(brewery.BreweryPostId)).ReturnsAsync(brewery); - BreweryDto? result = await _handler.Handle(new GetBreweryByIdQuery(brewery.BreweryPostId), CancellationToken.None); + BreweryDto? result = await _handler.Handle( + new GetBreweryByIdQuery(brewery.BreweryPostId), + CancellationToken.None + ); result.Should().NotBeNull(); result!.BreweryPostId.Should().Be(brewery.BreweryPostId); @@ -34,11 +36,13 @@ public class GetBreweryByIdHandlerTests public async Task Handle_ReturnsNull_WhenNotFound() { Guid id = Guid.NewGuid(); - _repoMock.Setup(r => r.GetByIdAsync(id)) - .ReturnsAsync((BreweryPost?)null); + _repoMock.Setup(r => r.GetByIdAsync(id)).ReturnsAsync((BreweryPost?)null); - BreweryDto? result = await _handler.Handle(new GetBreweryByIdQuery(id), CancellationToken.None); + BreweryDto? result = await _handler.Handle( + new GetBreweryByIdQuery(id), + CancellationToken.None + ); result.Should().BeNull(); } -} \ No newline at end of file +} diff --git a/web/backend/Features/Features.Breweries.Tests/Repository/BreweryRepositoryTests.cs b/web/backend/Features/Features.Breweries.Tests/Repository/BreweryRepositoryTests.cs index 5739564..eaffef0 100644 --- a/web/backend/Features/Features.Breweries.Tests/Repository/BreweryRepositoryTests.cs +++ b/web/backend/Features/Features.Breweries.Tests/Repository/BreweryRepositoryTests.cs @@ -81,8 +81,7 @@ public class BreweryRepositoryTests public async Task CreateAsync_ExecutesSuccessfully() { MockDbConnection conn = new(); - conn.Mocks.When(cmd => cmd.CommandText == "USP_CreateBrewery") - .ReturnsScalar(1); + conn.Mocks.When(cmd => cmd.CommandText == "USP_CreateBrewery").ReturnsScalar(1); BreweryRepository repo = CreateRepo(conn); BreweryPost brewery = new() { @@ -97,12 +96,12 @@ public class BreweryRepositoryTests CityId = Guid.NewGuid(), AddressLine1 = "123 Main St", PostalCode = "12345", - Coordinates = [0x00, 0x01] - } + Coordinates = [0x00, 0x01], + }, }; // Should not throw Func act = async () => await repo.CreateAsync(brewery); await act.Should().NotThrowAsync(); } -} \ No newline at end of file +} diff --git a/web/backend/Features/Features.Breweries.Tests/Repository/TestConnectionFactory.cs b/web/backend/Features/Features.Breweries.Tests/Repository/TestConnectionFactory.cs index 9ebb3fd..8ab7808 100644 --- a/web/backend/Features/Features.Breweries.Tests/Repository/TestConnectionFactory.cs +++ b/web/backend/Features/Features.Breweries.Tests/Repository/TestConnectionFactory.cs @@ -11,4 +11,4 @@ internal class TestConnectionFactory(DbConnection conn) : ISqlConnectionFactory { return _conn; } -} \ No newline at end of file +}