From c91538493bb7f0df42bb61f8d627e9f65d2d96da Mon Sep 17 00:00:00 2001 From: "a.kafrashian" Date: Sun, 4 May 2025 12:51:44 +0330 Subject: [PATCH] fix:unify 'flight' namespace in Booking and Flight modules --- .../Features/CreatingBook/V1/CreateBooking.cs | 4 +- .../Infrastructure/GrpcClientExtensions.cs | 2 +- .../src/GrpcClient/Protos/flight.proto | 2 +- .../Integration.Test/Integration.Test.csproj | 2 +- .../Seat/Features/GetAvailableSeatsTests.cs | 63 ++++++++--------- .../Seat/Features/ReserveSeatTests.cs | 69 +++++++++---------- .../src/Modules/Flight/tests/tests.sln | 31 +++++++++ 7 files changed, 100 insertions(+), 73 deletions(-) create mode 100644 2-modular-monolith-architecture-style/src/Modules/Flight/tests/tests.sln diff --git a/2-modular-monolith-architecture-style/src/Modules/Booking/src/Booking/Features/CreatingBook/V1/CreateBooking.cs b/2-modular-monolith-architecture-style/src/Modules/Booking/src/Booking/Features/CreatingBook/V1/CreateBooking.cs index bde40c0..4563c6f 100644 --- a/2-modular-monolith-architecture-style/src/Modules/Booking/src/Booking/Features/CreatingBook/V1/CreateBooking.cs +++ b/2-modular-monolith-architecture-style/src/Modules/Booking/src/Booking/Features/CreatingBook/V1/CreateBooking.cs @@ -1,6 +1,7 @@ namespace Booking.Booking.Features.CreatingBook.V1; using Ardalis.GuardClauses; +using BookingFlight; using BuildingBlocks.Core; using BuildingBlocks.Core.CQRS; using BuildingBlocks.Core.Event; @@ -9,7 +10,6 @@ using BuildingBlocks.EventStoreDB.Repository; using BuildingBlocks.Web; using Duende.IdentityServer.EntityFramework.Entities; using Exceptions; -using Flight; using FluentValidation; using Mapster; using MapsterMapper; @@ -99,7 +99,7 @@ internal class CreateBookingCommandHandler : ICommandHandler + diff --git a/2-modular-monolith-architecture-style/src/Modules/Flight/tests/Integration.Test/Seat/Features/GetAvailableSeatsTests.cs b/2-modular-monolith-architecture-style/src/Modules/Flight/tests/Integration.Test/Seat/Features/GetAvailableSeatsTests.cs index e870d8c..9a3fe1c 100644 --- a/2-modular-monolith-architecture-style/src/Modules/Flight/tests/Integration.Test/Seat/Features/GetAvailableSeatsTests.cs +++ b/2-modular-monolith-architecture-style/src/Modules/Flight/tests/Integration.Test/Seat/Features/GetAvailableSeatsTests.cs @@ -1,43 +1,40 @@ -//using System.Threading.Tasks; -//using BuildingBlocks.TestBase; -//using Flight; -//using Flight.Data; -//using FluentAssertions; -//using Integration.Test.Fakes; -//using Xunit; +using BuildingBlocks.TestBase; +using Flight; +using Flight.Data; +using FluentAssertions; +using Integration.Test.Fakes; +using Xunit; -//namespace Integration.Test.Seat.Features; +namespace Integration.Test.Seat.Features; -//using Api; -//using global::Flight.Flights.Features.CreatingFlight.V1; -//using global::Flight.Seats.Features.CreatingSeat.V1; +using Api; -//public class GetAvailableSeatsTests : FlightIntegrationTestBase -//{ -// public GetAvailableSeatsTests( -// TestFixture integrationTestFactory) : base(integrationTestFactory) -// { -// } +public class GetAvailableSeatsTests : FlightIntegrationTestBase +{ + public GetAvailableSeatsTests( + TestFixture integrationTestFactory) : base(integrationTestFactory) + { + } -// [Fact] -// public async Task should_return_available_seats_from_grpc_service() -// { -// // Arrange -// var flightCommand = new FakeCreateFlightMongoCommand().Generate(); + [Fact] + public async Task should_return_available_seats_from_grpc_service() + { + // Arrange + var flightCommand = new FakeCreateFlightMongoCommand().Generate(); -// await Fixture.SendAsync(flightCommand); + await Fixture.SendAsync(flightCommand); -// var seatCommand = new FakeCreateSeatMongoCommand(flightCommand.Id).Generate(); + var seatCommand = new FakeCreateSeatMongoCommand(flightCommand.Id).Generate(); -// await Fixture.SendAsync(seatCommand); + await Fixture.SendAsync(seatCommand); -// var flightGrpcClient = new FlightGrpcService.FlightGrpcServiceClient(Fixture.Channel); + var flightGrpcClient = new FlightGrpcService.FlightGrpcServiceClient(Fixture.Channel); -// // Act -// var response = await flightGrpcClient.GetAvailableSeatsAsync(new GetAvailableSeatsRequest { FlightId = flightCommand.Id.ToString() }); + // Act + var response = await flightGrpcClient.GetAvailableSeatsAsync(new GetAvailableSeatsRequest { FlightId = flightCommand.Id.ToString() }); -// // Assert -// response?.Should().NotBeNull(); -// response?.SeatDtos?.Count.Should().BeGreaterOrEqualTo(1); -// } -//} + // Assert + response?.Should().NotBeNull(); + response?.SeatDtos?.Count.Should().BeGreaterOrEqualTo(1); + } +} diff --git a/2-modular-monolith-architecture-style/src/Modules/Flight/tests/Integration.Test/Seat/Features/ReserveSeatTests.cs b/2-modular-monolith-architecture-style/src/Modules/Flight/tests/Integration.Test/Seat/Features/ReserveSeatTests.cs index 7460aa4..7e994cf 100644 --- a/2-modular-monolith-architecture-style/src/Modules/Flight/tests/Integration.Test/Seat/Features/ReserveSeatTests.cs +++ b/2-modular-monolith-architecture-style/src/Modules/Flight/tests/Integration.Test/Seat/Features/ReserveSeatTests.cs @@ -1,43 +1,42 @@ -//using System.Threading.Tasks; -//using Api; -//using BuildingBlocks.TestBase; -//using Flight; -//using Flight.Data; -//using FluentAssertions; -//using Integration.Test.Fakes; -//using Xunit; +using Api; +using BuildingBlocks.TestBase; +using Flight; +using Flight.Data; +using FluentAssertions; +using Integration.Test.Fakes; +using Xunit; -//namespace Integration.Test.Seat.Features; -//public class ReserveSeatTests : FlightIntegrationTestBase -//{ -// public ReserveSeatTests( -// TestFixture integrationTestFactory) : base(integrationTestFactory) -// { -// } +namespace Integration.Test.Seat.Features; +public class ReserveSeatTests : FlightIntegrationTestBase +{ + public ReserveSeatTests( + TestFixture integrationTestFactory) : base(integrationTestFactory) + { + } -// [Fact] -// public async Task should_return_valid_reserve_seat_from_grpc_service() -// { -// // Arrange -// var flightCommand = new FakeCreateFlightCommand().Generate(); + [Fact] + public async Task should_return_valid_reserve_seat_from_grpc_service() + { + // Arrange + var flightCommand = new FakeCreateFlightCommand().Generate(); -// await Fixture.SendAsync(flightCommand); + await Fixture.SendAsync(flightCommand); -// var seatCommand = new FakeCreateSeatCommand(flightCommand.Id).Generate(); + var seatCommand = new FakeCreateSeatCommand(flightCommand.Id).Generate(); -// await Fixture.SendAsync(seatCommand); + await Fixture.SendAsync(seatCommand); -// var flightGrpcClient = new FlightGrpcService.FlightGrpcServiceClient(Fixture.Channel); + var flightGrpcClient = new FlightGrpcService.FlightGrpcServiceClient(Fixture.Channel); -// // Act -// var response = await flightGrpcClient.ReserveSeatAsync(new ReserveSeatRequest() -// { -// FlightId = seatCommand.FlightId.ToString(), -// SeatNumber = seatCommand.SeatNumber -// }); + // Act + var response = await flightGrpcClient.ReserveSeatAsync(new ReserveSeatRequest() + { + FlightId = seatCommand.FlightId.ToString(), + SeatNumber = seatCommand.SeatNumber + }); -// // Assert -// response?.Should().NotBeNull(); -// response?.Id.Should().Be(seatCommand?.Id.ToString()); -// } -//} + // Assert + response?.Should().NotBeNull(); + response?.Id.Should().Be(seatCommand?.Id.ToString()); + } +} diff --git a/2-modular-monolith-architecture-style/src/Modules/Flight/tests/tests.sln b/2-modular-monolith-architecture-style/src/Modules/Flight/tests/tests.sln new file mode 100644 index 0000000..192fd2d --- /dev/null +++ b/2-modular-monolith-architecture-style/src/Modules/Flight/tests/tests.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.13.35931.197 d17.13 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unit.Test", "Unit.Test\Unit.Test.csproj", "{9FF9D3A3-D316-461F-90D8-A51226796AB8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration.Test", "Integration.Test\Integration.Test.csproj", "{7CD2A0EF-7505-43D5-A428-8F8EB4C8004F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9FF9D3A3-D316-461F-90D8-A51226796AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FF9D3A3-D316-461F-90D8-A51226796AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FF9D3A3-D316-461F-90D8-A51226796AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FF9D3A3-D316-461F-90D8-A51226796AB8}.Release|Any CPU.Build.0 = Release|Any CPU + {7CD2A0EF-7505-43D5-A428-8F8EB4C8004F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7CD2A0EF-7505-43D5-A428-8F8EB4C8004F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7CD2A0EF-7505-43D5-A428-8F8EB4C8004F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7CD2A0EF-7505-43D5-A428-8F8EB4C8004F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4EB6EA31-EAFC-4770-A32B-52E5EFF62E05} + EndGlobalSection +EndGlobal