mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-30 18:15:46 +08:00
fix:unify 'flight' namespace in Booking and Flight modules
This commit is contained in:
parent
660cac9ee5
commit
c91538493b
@ -1,6 +1,7 @@
|
|||||||
namespace Booking.Booking.Features.CreatingBook.V1;
|
namespace Booking.Booking.Features.CreatingBook.V1;
|
||||||
|
|
||||||
using Ardalis.GuardClauses;
|
using Ardalis.GuardClauses;
|
||||||
|
using BookingFlight;
|
||||||
using BuildingBlocks.Core;
|
using BuildingBlocks.Core;
|
||||||
using BuildingBlocks.Core.CQRS;
|
using BuildingBlocks.Core.CQRS;
|
||||||
using BuildingBlocks.Core.Event;
|
using BuildingBlocks.Core.Event;
|
||||||
@ -9,7 +10,6 @@ using BuildingBlocks.EventStoreDB.Repository;
|
|||||||
using BuildingBlocks.Web;
|
using BuildingBlocks.Web;
|
||||||
using Duende.IdentityServer.EntityFramework.Entities;
|
using Duende.IdentityServer.EntityFramework.Entities;
|
||||||
using Exceptions;
|
using Exceptions;
|
||||||
using Flight;
|
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using MapsterMapper;
|
using MapsterMapper;
|
||||||
@ -99,7 +99,7 @@ internal class CreateBookingCommandHandler : ICommandHandler<CreateBooking, Crea
|
|||||||
Guard.Against.Null(command, nameof(command));
|
Guard.Against.Null(command, nameof(command));
|
||||||
|
|
||||||
var flight =
|
var flight =
|
||||||
await _flightGrpcServiceClient.GetByIdAsync(new Flight.GetByIdRequest { Id = command.FlightId.ToString() }, cancellationToken: cancellationToken);
|
await _flightGrpcServiceClient.GetByIdAsync(new BookingFlight.GetByIdRequest { Id = command.FlightId.ToString() }, cancellationToken: cancellationToken);
|
||||||
|
|
||||||
if (flight is null)
|
if (flight is null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using Booking.Configuration;
|
using Booking.Configuration;
|
||||||
|
using BookingFlight;
|
||||||
using BuildingBlocks.Web;
|
using BuildingBlocks.Web;
|
||||||
using Flight;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Passenger;
|
using Passenger;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package flight;
|
package bookingFlight;
|
||||||
import "google/protobuf/timestamp.proto";
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
service FlightGrpcService {
|
service FlightGrpcService {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="xunit.runner.json">
|
<None Update="xunit.runner.json">
|
||||||
|
|||||||
@ -1,43 +1,40 @@
|
|||||||
//using System.Threading.Tasks;
|
using BuildingBlocks.TestBase;
|
||||||
//using BuildingBlocks.TestBase;
|
using Flight;
|
||||||
//using Flight;
|
using Flight.Data;
|
||||||
//using Flight.Data;
|
using FluentAssertions;
|
||||||
//using FluentAssertions;
|
using Integration.Test.Fakes;
|
||||||
//using Integration.Test.Fakes;
|
using Xunit;
|
||||||
//using Xunit;
|
|
||||||
|
|
||||||
//namespace Integration.Test.Seat.Features;
|
namespace Integration.Test.Seat.Features;
|
||||||
|
|
||||||
//using Api;
|
using Api;
|
||||||
//using global::Flight.Flights.Features.CreatingFlight.V1;
|
|
||||||
//using global::Flight.Seats.Features.CreatingSeat.V1;
|
|
||||||
|
|
||||||
//public class GetAvailableSeatsTests : FlightIntegrationTestBase
|
public class GetAvailableSeatsTests : FlightIntegrationTestBase
|
||||||
//{
|
{
|
||||||
// public GetAvailableSeatsTests(
|
public GetAvailableSeatsTests(
|
||||||
// TestFixture<Program, FlightDbContext, FlightReadDbContext> integrationTestFactory) : base(integrationTestFactory)
|
TestFixture<Program, FlightDbContext, FlightReadDbContext> integrationTestFactory) : base(integrationTestFactory)
|
||||||
// {
|
{
|
||||||
// }
|
}
|
||||||
|
|
||||||
// [Fact]
|
[Fact]
|
||||||
// public async Task should_return_available_seats_from_grpc_service()
|
public async Task should_return_available_seats_from_grpc_service()
|
||||||
// {
|
{
|
||||||
// // Arrange
|
// Arrange
|
||||||
// var flightCommand = new FakeCreateFlightMongoCommand().Generate();
|
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
|
// Act
|
||||||
// var response = await flightGrpcClient.GetAvailableSeatsAsync(new GetAvailableSeatsRequest { FlightId = flightCommand.Id.ToString() });
|
var response = await flightGrpcClient.GetAvailableSeatsAsync(new GetAvailableSeatsRequest { FlightId = flightCommand.Id.ToString() });
|
||||||
|
|
||||||
// // Assert
|
// Assert
|
||||||
// response?.Should().NotBeNull();
|
response?.Should().NotBeNull();
|
||||||
// response?.SeatDtos?.Count.Should().BeGreaterOrEqualTo(1);
|
response?.SeatDtos?.Count.Should().BeGreaterOrEqualTo(1);
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|||||||
@ -1,43 +1,42 @@
|
|||||||
//using System.Threading.Tasks;
|
using Api;
|
||||||
//using Api;
|
using BuildingBlocks.TestBase;
|
||||||
//using BuildingBlocks.TestBase;
|
using Flight;
|
||||||
//using Flight;
|
using Flight.Data;
|
||||||
//using Flight.Data;
|
using FluentAssertions;
|
||||||
//using FluentAssertions;
|
using Integration.Test.Fakes;
|
||||||
//using Integration.Test.Fakes;
|
using Xunit;
|
||||||
//using Xunit;
|
|
||||||
|
|
||||||
//namespace Integration.Test.Seat.Features;
|
namespace Integration.Test.Seat.Features;
|
||||||
//public class ReserveSeatTests : FlightIntegrationTestBase
|
public class ReserveSeatTests : FlightIntegrationTestBase
|
||||||
//{
|
{
|
||||||
// public ReserveSeatTests(
|
public ReserveSeatTests(
|
||||||
// TestFixture<Program, FlightDbContext, FlightReadDbContext> integrationTestFactory) : base(integrationTestFactory)
|
TestFixture<Program, FlightDbContext, FlightReadDbContext> integrationTestFactory) : base(integrationTestFactory)
|
||||||
// {
|
{
|
||||||
// }
|
}
|
||||||
|
|
||||||
// [Fact]
|
[Fact]
|
||||||
// public async Task should_return_valid_reserve_seat_from_grpc_service()
|
public async Task should_return_valid_reserve_seat_from_grpc_service()
|
||||||
// {
|
{
|
||||||
// // Arrange
|
// Arrange
|
||||||
// var flightCommand = new FakeCreateFlightCommand().Generate();
|
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
|
// Act
|
||||||
// var response = await flightGrpcClient.ReserveSeatAsync(new ReserveSeatRequest()
|
var response = await flightGrpcClient.ReserveSeatAsync(new ReserveSeatRequest()
|
||||||
// {
|
{
|
||||||
// FlightId = seatCommand.FlightId.ToString(),
|
FlightId = seatCommand.FlightId.ToString(),
|
||||||
// SeatNumber = seatCommand.SeatNumber
|
SeatNumber = seatCommand.SeatNumber
|
||||||
// });
|
});
|
||||||
|
|
||||||
// // Assert
|
// Assert
|
||||||
// response?.Should().NotBeNull();
|
response?.Should().NotBeNull();
|
||||||
// response?.Id.Should().Be(seatCommand?.Id.ToString());
|
response?.Id.Should().Be(seatCommand?.Id.ToString());
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
|
|||||||
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user