diff --git a/src/BuildingBlocks/BuildingBlocks.csproj b/src/BuildingBlocks/BuildingBlocks.csproj
index d9b84d7..97bc3c0 100644
--- a/src/BuildingBlocks/BuildingBlocks.csproj
+++ b/src/BuildingBlocks/BuildingBlocks.csproj
@@ -17,7 +17,6 @@
-
@@ -28,7 +27,6 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
@@ -52,7 +50,6 @@
-
@@ -121,7 +118,6 @@
-
diff --git a/src/BuildingBlocks/Contracts/Grpc/PassengerGrpcContracts.cs b/src/BuildingBlocks/Contracts/Grpc/PassengerGrpcContracts.cs
index 5e8e7b1..6bf08ed 100644
--- a/src/BuildingBlocks/Contracts/Grpc/PassengerGrpcContracts.cs
+++ b/src/BuildingBlocks/Contracts/Grpc/PassengerGrpcContracts.cs
@@ -6,7 +6,6 @@ namespace BuildingBlocks.Contracts.Grpc;
public interface IPassengerGrpcService : IService
{
UnaryResult GetById(long id);
- UnaryResult TTT(long id);
}
diff --git a/src/BuildingBlocks/Web/ServiceCollectionExtensions.cs b/src/BuildingBlocks/Web/ServiceCollectionExtensions.cs
index 74f723d..075a2b2 100644
--- a/src/BuildingBlocks/Web/ServiceCollectionExtensions.cs
+++ b/src/BuildingBlocks/Web/ServiceCollectionExtensions.cs
@@ -1,4 +1,7 @@
-using Microsoft.Extensions.DependencyInjection;
+using BuildingBlocks.Contracts.Grpc;
+using Microsoft.Extensions.DependencyInjection;
+using Moq;
+using NSubstitute;
namespace BuildingBlocks.Web;
@@ -57,4 +60,14 @@ public static class ServiceCollectionExtensions
var descriptor = services.FirstOrDefault(d => d.ServiceType == typeof(TService));
services.Remove(descriptor);
}
+
+ public static IServiceCollection ReplaceServiceWithSingletonMock(this IServiceCollection services)
+ where TService : class
+ {
+ var service = services.FirstOrDefault(d => d.ServiceType == typeof(TService));
+ services.Remove(service);
+
+ services.AddSingleton(_ => Substitute.For());
+ return services;
+ }
}
diff --git a/src/Services/Booking/src/Booking.Api/Program.cs b/src/Services/Booking/src/Booking.Api/Program.cs
index 71dc7fb..3e413fc 100644
--- a/src/Services/Booking/src/Booking.Api/Program.cs
+++ b/src/Services/Booking/src/Booking.Api/Program.cs
@@ -50,6 +50,9 @@ builder.Services.AddTransient();
builder.Services.AddCustomMassTransit(typeof(BookingRoot).Assembly, env);
builder.Services.AddCustomOpenTelemetry();
builder.Services.AddTransient();
+
+builder.Services.AddMagicOnionClients();
+
SnowFlakIdGenerator.Configure(3);
// ref: https://github.com/oskardudycz/EventSourcing.NetCore/tree/main/Sample/EventStoreDB/ECommerce
@@ -84,4 +87,6 @@ app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
app.Run();
-public partial class Program {}
+public partial class Program
+{
+}
diff --git a/src/Services/Booking/src/Booking/Booking.csproj b/src/Services/Booking/src/Booking/Booking.csproj
index 17ff60f..e15133a 100644
--- a/src/Services/Booking/src/Booking/Booking.csproj
+++ b/src/Services/Booking/src/Booking/Booking.csproj
@@ -6,28 +6,15 @@
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
- Protos\foo.proto
-
-
diff --git a/src/Services/Booking/src/Booking/Booking/Features/CreateBooking/CreateBookingCommandHandler.cs b/src/Services/Booking/src/Booking/Booking/Features/CreateBooking/CreateBookingCommandHandler.cs
index 0ef29a5..35085ff 100644
--- a/src/Services/Booking/src/Booking/Booking/Features/CreateBooking/CreateBookingCommandHandler.cs
+++ b/src/Services/Booking/src/Booking/Booking/Features/CreateBooking/CreateBookingCommandHandler.cs
@@ -1,14 +1,9 @@
using Ardalis.GuardClauses;
using Booking.Booking.Exceptions;
using Booking.Booking.Models.ValueObjects;
-using Booking.Configuration;
using BuildingBlocks.Contracts.Grpc;
using BuildingBlocks.EventStoreDB.Repository;
-using Grpc.Net.Client;
-using MagicOnion.Client;
-using MapsterMapper;
using MediatR;
-using Microsoft.Extensions.Options;
namespace Booking.Booking.Features.CreateBooking;
@@ -18,52 +13,47 @@ public class CreateBookingCommandHandler : IRequestHandler grpcOptions,
- IEventStoreDBRepository eventStoreDbRepository)
+ public CreateBookingCommandHandler(IEventStoreDBRepository eventStoreDbRepository,
+ IPassengerGrpcService passengerGrpcService,
+ IFlightGrpcService flightGrpcService)
{
_eventStoreDbRepository = eventStoreDbRepository;
-
- var channelFlight = GrpcChannel.ForAddress(grpcOptions.Value.FlightAddress);
- _flightGrpcService = new Lazy(() => MagicOnionClient.Create(channelFlight)).Value;
-
- var channelPassenger = GrpcChannel.ForAddress(grpcOptions.Value.PassengerAddress);
- _passengerGrpcService = new Lazy(() => MagicOnionClient.Create(channelPassenger)).Value;
+ _passengerGrpcService = passengerGrpcService;
+ _flightGrpcService = flightGrpcService;
}
public async Task Handle(CreateBookingCommand command,
CancellationToken cancellationToken)
{
- // Guard.Against.Null(command, nameof(command));
- //
- // var flight = await _flightGrpcService.GetById(command.FlightId);
- //
- // if (flight is null)
- // throw new FlightNotFoundException();
+ Guard.Against.Null(command, nameof(command));
+
+ var flight = await _flightGrpcService.GetById(command.FlightId);
+
+ if (flight is null)
+ throw new FlightNotFoundException();
var passenger = await _passengerGrpcService.GetById(command.PassengerId);
- // var emptySeat = (await _flightGrpcService.GetAvailableSeats(command.FlightId))?.First();
- //
- // var reservation = await _eventStoreDbRepository.Find(command.Id, cancellationToken);
- //
- // if (reservation is not null && !reservation.IsDeleted)
- // throw new BookingAlreadyExistException();
- //
- // var aggrigate = Models.Booking.Create(command.Id, new PassengerInfo(passenger.Name), new Trip(
- // flight.FlightNumber, flight.AircraftId, flight.DepartureAirportId,
- // flight.ArriveAirportId, flight.FlightDate, flight.Price, command.Description, emptySeat?.SeatNumber));
- //
- // await _flightGrpcService.ReserveSeat(new ReserveSeatRequestDto
- // {
- // FlightId = flight.Id, SeatNumber = emptySeat?.SeatNumber
- // });
- //
- // var result = await _eventStoreDbRepository.Add(
- // aggrigate,
- // cancellationToken);
+ var emptySeat = (await _flightGrpcService.GetAvailableSeats(command.FlightId))?.First();
- return 2;
+ var reservation = await _eventStoreDbRepository.Find(command.Id, cancellationToken);
+
+ if (reservation is not null && !reservation.IsDeleted)
+ throw new BookingAlreadyExistException();
+
+ var aggrigate = Models.Booking.Create(command.Id, new PassengerInfo(passenger.Name), new Trip(
+ flight.FlightNumber, flight.AircraftId, flight.DepartureAirportId,
+ flight.ArriveAirportId, flight.FlightDate, flight.Price, command.Description, emptySeat?.SeatNumber));
+
+ await _flightGrpcService.ReserveSeat(new ReserveSeatRequestDto
+ {
+ FlightId = flight.Id, SeatNumber = emptySeat?.SeatNumber
+ });
+
+ var result = await _eventStoreDbRepository.Add(
+ aggrigate,
+ cancellationToken);
+
+ return result;
}
}
diff --git a/src/Services/Booking/src/Booking/Configuration/RefitOptions.cs b/src/Services/Booking/src/Booking/Configuration/RefitOptions.cs
deleted file mode 100644
index f512276..0000000
--- a/src/Services/Booking/src/Booking/Configuration/RefitOptions.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Booking.Configuration;
-
-public class RefitOptions
-{
- public string FlightAddress { get; set; }
- public string PassengerAddress { get; set; }
-}
\ No newline at end of file
diff --git a/src/Services/Booking/src/Booking/Extensions/MagicOnionClientExtensions.cs b/src/Services/Booking/src/Booking/Extensions/MagicOnionClientExtensions.cs
new file mode 100644
index 0000000..73ccc3e
--- /dev/null
+++ b/src/Services/Booking/src/Booking/Extensions/MagicOnionClientExtensions.cs
@@ -0,0 +1,21 @@
+using Booking.Configuration;
+using BuildingBlocks.Contracts.Grpc;
+using BuildingBlocks.Web;
+using Grpc.Net.Client;
+using MagicOnion.Client;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Booking.Extensions;
+
+public static class MagicOnionClientExtensions
+{
+ public static IServiceCollection AddMagicOnionClients(this IServiceCollection services)
+ {
+ var grpcOptions = services.GetOptions("Grpc");
+
+ services.AddSingleton(x => MagicOnionClient.Create(GrpcChannel.ForAddress(grpcOptions.PassengerAddress)));
+ services.AddSingleton(x => MagicOnionClient.Create(GrpcChannel.ForAddress(grpcOptions.FlightAddress)));
+
+ return services;
+ }
+}
diff --git a/src/Services/Booking/src/Booking/Protos/foo.proto b/src/Services/Booking/src/Booking/Protos/foo.proto
deleted file mode 100644
index 8b225d8..0000000
--- a/src/Services/Booking/src/Booking/Protos/foo.proto
+++ /dev/null
@@ -1,25 +0,0 @@
-syntax = "proto3";
-option csharp_namespace = "GrpcSamples";
-
-service FooService {
- rpc GetFoo (FooRequest) returns (FooResponse);
-
- rpc GetFoos(FooServerStreamingRequest) returns (stream FooResponse);
-
- rpc SendFoos(stream FooRequest) returns (FooResponse);
-
- rpc SendAndGetFoos(stream FooRequest) returns (stream FooResponse);
-}
-
-message FooRequest {
- string message = 1;
-}
-
-message FooServerStreamingRequest {
- string message = 1;
- int32 messageCount = 2;
-}
-
-message FooResponse {
- string message = 1;
-}
diff --git a/src/Services/Booking/tests/IntegrationTest/Booking/Features/CreateBookingTests.cs b/src/Services/Booking/tests/IntegrationTest/Booking/Features/CreateBookingTests.cs
index 6869128..0c16d0b 100644
--- a/src/Services/Booking/tests/IntegrationTest/Booking/Features/CreateBookingTests.cs
+++ b/src/Services/Booking/tests/IntegrationTest/Booking/Features/CreateBookingTests.cs
@@ -1,15 +1,14 @@
-using System.Threading.Tasks;
-using BuildingBlocks.Contracts.EventBus.Messages;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
using BuildingBlocks.Contracts.Grpc;
using FluentAssertions;
-using Grpc.Core;
using Grpc.Net.Client;
-using GrpcSamples;
using Integration.Test.Fakes;
using MagicOnion;
-using MagicOnion.Client;
using MassTransit.Testing;
using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
using NSubstitute;
using Xunit;
@@ -18,91 +17,67 @@ namespace Integration.Test.Booking.Features;
[Collection(nameof(IntegrationTestFixture))]
public class CreateBookingTests
{
+ private readonly GrpcChannel _channel;
private readonly IntegrationTestFixture _fixture;
private readonly ITestHarness _testHarness;
- private readonly GrpcChannel _channel;
- private FooService.FooServiceClient _fooServiceClient;
public CreateBookingTests(IntegrationTestFixture fixture)
{
_fixture = fixture;
+
+ _fixture.RegisterTestServices(services =>
+ {
+ MockFlightGrpcServices(services);
+ MockPassengerGrpcServices(services);
+ });
+
_testHarness = fixture.TestHarness;
_channel = fixture.Channel;
- _fooServiceClient = Substitute.For();
-
- _fooServiceClient.GetFoo(Arg.Any())
- .Returns(new FooResponse() {Message = "vvvvvvvvvvv"});
-
- fixture.RegisterTestServices(services =>
- {
- services.AddSingleton(_fooServiceClient);
- });
}
+ // todo: add support test for event-store
[Fact]
- public async Task should_create_booking_currectly()
+ public async Task should_create_booking_to_event_store_currectly()
{
// Arrange
var command = new FakeCreateBookingCommand().Generate();
- // var passengerGrpcService = MagicOnionClient.Create(_channel) as IPassengerGrpcService2;
- // var b = await passengerGrpcService.GetById(1);
-
- // var client = new FooService.FooServiceClient(_channel);
- //
- // var b = client.GetFoo(new FooRequest {Message = "tesssssssssst"});
- _fooServiceClient = Substitute.For();
-
- _fooServiceClient.GetFooAsync(Arg.Any())
- .Returns(new AsyncUnaryCall(Task.FromResult(new FooResponse() {Message = "uuuuuuuuu"}), null, null, null, null));
- //
-
-
// Act
var response = await _fixture.SendAsync(command);
// Assert
- response.Should();
+ response.Should().BeGreaterOrEqualTo(0);
}
+ private void MockPassengerGrpcServices(IServiceCollection services)
+ {
+ services.Replace(ServiceDescriptor.Singleton(x =>
+ {
+ var mock = Substitute.For();
+ mock.GetById(Arg.Any())
+ .Returns(new UnaryResult(new FakePassengerResponseDto().Generate()));
- // [Fact]
- // public async Task should_retrive_a_passenger_by_id_currectly()
- // {
- // // Arrange
- // var userCreated = new FakeUserCreated().Generate();
- // await _testHarness.Bus.Publish(userCreated);
- // await _testHarness.Consumed.Any();
- // var passengerEntity = FakePassengerCreated.Generate(userCreated);
- // await _fixture.InsertAsync(passengerEntity);
- //
- // var query = new GetPassengerQueryById(passengerEntity.Id);
- //
- // // Act
- // var response = await _fixture.SendAsync(query);
- //
- // // Assert
- // response.Should().NotBeNull();
- // response?.Id.Should().Be(passengerEntity.Id);
- // }
- //
- // [Fact]
- // public async Task should_retrive_a_passenger_by_id_from_grpc_service()
- // {
- // // Arrange
- // var userCreated = new FakeUserCreated().Generate();
- // await _testHarness.Bus.Publish(userCreated);
- // await _testHarness.Consumed.Any();
- // var passengerEntity = FakePassengerCreated.Generate(userCreated);
- // await _fixture.InsertAsync(passengerEntity);
- //
- // var passengerGrpcClient = MagicOnionClient.Create(_channel);
- //
- // // Act
- // var response = await passengerGrpcClient.GetById(1111111111);
- //
- // // Assert
- // response?.Should().NotBeNull();
- // response?.Id.Should().Be(passengerEntity.Id);
- // }
+ return mock;
+ }));
+ }
+
+ private void MockFlightGrpcServices(IServiceCollection services)
+ {
+ services.Replace(ServiceDescriptor.Singleton(x =>
+ {
+ var mock = Substitute.For();
+
+ mock.GetById(Arg.Any())
+ .Returns(new UnaryResult(Task.FromResult(new FakeFlightResponseDto().Generate())));
+
+ mock.GetAvailableSeats(Arg.Any())
+ .Returns(
+ new UnaryResult>(Task.FromResult(FakeSeatsResponseDto.Generate())));
+
+ mock.ReserveSeat(new FakeReserveSeatRequestDto().Generate())
+ .Returns(new UnaryResult(Task.FromResult(FakeSeatsResponseDto.Generate().First())));
+
+ return mock;
+ }));
+ }
}
diff --git a/src/Services/Booking/tests/IntegrationTest/CustomWebApplicationFactory.cs b/src/Services/Booking/tests/IntegrationTest/CustomWebApplicationFactory.cs
index 87db371..fcd1a13 100644
--- a/src/Services/Booking/tests/IntegrationTest/CustomWebApplicationFactory.cs
+++ b/src/Services/Booking/tests/IntegrationTest/CustomWebApplicationFactory.cs
@@ -55,15 +55,6 @@ public class CustomWebApplicationFactory : WebApplicationFactory
TestRegistrationServices?.Invoke(services);
});
-
- builder.UseDefaultServiceProvider((env, c) =>
- {
- // Handling Captive Dependency Problem
- // https://ankitvijay.net/2020/03/17/net-core-and-di-beware-of-captive-dependency/
- // https://blog.ploeh.dk/2014/06/02/captive-dependency/
- if (env.HostingEnvironment.IsEnvironment("test") || env.HostingEnvironment.IsDevelopment())
- c.ValidateScopes = true;
- });
}
private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
@@ -77,4 +68,4 @@ public class CustomWebApplicationFactory : WebApplicationFactory
return httpContextAccessorMock;
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/Booking/tests/IntegrationTest/Fakes/FakeFlightResponseDto.cs b/src/Services/Booking/tests/IntegrationTest/Fakes/FakeFlightResponseDto.cs
new file mode 100644
index 0000000..67ff88b
--- /dev/null
+++ b/src/Services/Booking/tests/IntegrationTest/Fakes/FakeFlightResponseDto.cs
@@ -0,0 +1,22 @@
+using System;
+using AutoBogus;
+using BuildingBlocks.Contracts.Grpc;
+
+namespace Integration.Test.Fakes;
+
+public class FakeFlightResponseDto : AutoFaker
+{
+ public FakeFlightResponseDto()
+ {
+ RuleFor(r => r.Id, _ => 1);
+ RuleFor(r => r.Price, _ => 100);
+ RuleFor(r => r.Status, _ => FlightStatus.Completed);
+ RuleFor(r => r.AircraftId, _ => 1);
+ RuleFor(r => r.ArriveAirportId, _ => 1);
+ RuleFor(r => r.ArriveDate, _ => DateTime.Now);
+ RuleFor(r => r.DepartureDate, _ => DateTime.Now);
+ RuleFor(r => r.FlightDate, _ => DateTime.Now);
+ RuleFor(r => r.FlightNumber, _ => "121LP");
+ RuleFor(r => r.DepartureAirportId, _ => 2);
+ }
+}
diff --git a/src/Services/Booking/tests/IntegrationTest/Fakes/FakePassengerResponseDto.cs b/src/Services/Booking/tests/IntegrationTest/Fakes/FakePassengerResponseDto.cs
new file mode 100644
index 0000000..9aaf4f8
--- /dev/null
+++ b/src/Services/Booking/tests/IntegrationTest/Fakes/FakePassengerResponseDto.cs
@@ -0,0 +1,13 @@
+using AutoBogus;
+using BuildingBlocks.Contracts.Grpc;
+using BuildingBlocks.IdsGenerator;
+
+namespace Integration.Test.Fakes;
+
+public class FakePassengerResponseDto : AutoFaker
+{
+ public FakePassengerResponseDto()
+ {
+ RuleFor(r => r.Id, _ => SnowFlakIdGenerator.NewId());
+ }
+}
diff --git a/src/Services/Booking/tests/IntegrationTest/Fakes/FakeReserveSeatRequestDto.cs b/src/Services/Booking/tests/IntegrationTest/Fakes/FakeReserveSeatRequestDto.cs
new file mode 100644
index 0000000..058cee5
--- /dev/null
+++ b/src/Services/Booking/tests/IntegrationTest/Fakes/FakeReserveSeatRequestDto.cs
@@ -0,0 +1,13 @@
+using AutoBogus;
+using BuildingBlocks.Contracts.Grpc;
+
+namespace Integration.Test.Fakes;
+
+public class FakeReserveSeatRequestDto : AutoFaker
+{
+ public FakeReserveSeatRequestDto()
+ {
+ RuleFor(r => r.FlightId, _ => 1);
+ RuleFor(r => r.SeatNumber, _ => "33F");
+ }
+}
diff --git a/src/Services/Booking/tests/IntegrationTest/Fakes/FakeSeatsResponseDto.cs b/src/Services/Booking/tests/IntegrationTest/Fakes/FakeSeatsResponseDto.cs
new file mode 100644
index 0000000..b1af511
--- /dev/null
+++ b/src/Services/Booking/tests/IntegrationTest/Fakes/FakeSeatsResponseDto.cs
@@ -0,0 +1,30 @@
+using System.Collections.Generic;
+using BuildingBlocks.Contracts.Grpc;
+
+namespace Integration.Test.Fakes;
+
+public static class FakeSeatsResponseDto
+{
+ public static IEnumerable Generate()
+ {
+ return new List()
+ {
+ new SeatResponseDto()
+ {
+ FlightId = 1,
+ Class = SeatClass.Economy,
+ Type = SeatType.Aisle,
+ SeatNumber = "33F",
+ Id = 1
+ },
+ new SeatResponseDto()
+ {
+ FlightId = 1,
+ Class = SeatClass.Economy,
+ Type = SeatType.Window,
+ SeatNumber = "22D",
+ Id = 2
+ }
+ };
+ }
+}
diff --git a/src/Services/Booking/tests/IntegrationTest/IntegrationTestFixture.cs b/src/Services/Booking/tests/IntegrationTest/IntegrationTestFixture.cs
index b0e5f05..eaa4bfd 100644
--- a/src/Services/Booking/tests/IntegrationTest/IntegrationTestFixture.cs
+++ b/src/Services/Booking/tests/IntegrationTest/IntegrationTestFixture.cs
@@ -3,15 +3,11 @@ using System.Net.Http;
using System.Threading.Tasks;
using Booking.Data;
using BuildingBlocks.Domain.Model;
-using BuildingBlocks.EFCore;
using Grpc.Net.Client;
using MassTransit.Testing;
using MediatR;
-using Microsoft.AspNetCore.Http;
-using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using NSubstitute;
using Serilog;
using Xunit;
using Xunit.Abstractions;
@@ -19,7 +15,9 @@ using Xunit.Abstractions;
namespace Integration.Test;
[CollectionDefinition(nameof(IntegrationTestFixture))]
-public class SliceFixtureCollection : ICollectionFixture { }
+public class SliceFixtureCollection : ICollectionFixture
+{
+}
public class IntegrationTestFixture : IAsyncLifetime
{
@@ -37,21 +35,6 @@ public class IntegrationTestFixture : IAsyncLifetime
public ITestHarness TestHarness => CreateHarness();
public GrpcChannel Channel => CreateChannel();
- // ref: https://github.com/trbenning/serilog-sinks-xunit
- public ILogger CreateLogger(ITestOutputHelper output)
- {
- if (output != null)
- {
- return new LoggerConfiguration()
- .WriteTo.TestOutput(output)
- .CreateLogger();
- }
-
- return null;
- }
-
- public void RegisterTestServices(Action services) => _factory.TestRegistrationServices = services;
-
public virtual Task InitializeAsync()
{
return Task.CompletedTask;
@@ -65,6 +48,22 @@ public class IntegrationTestFixture : IAsyncLifetime
await _factory.DisposeAsync();
}
+ // ref: https://github.com/trbenning/serilog-sinks-xunit
+ public ILogger CreateLogger(ITestOutputHelper output)
+ {
+ if (output != null)
+ return new LoggerConfiguration()
+ .WriteTo.TestOutput(output)
+ .CreateLogger();
+
+ return null;
+ }
+
+ public void RegisterTestServices(Action services)
+ {
+ _factory.TestRegistrationServices = services;
+ }
+
public async Task ExecuteScopeAsync(Func action)
{
using var scope = ServiceProvider.CreateScope();
@@ -202,18 +201,6 @@ public class IntegrationTestFixture : IAsyncLifetime
});
}
- private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
- {
- var httpContextAccessorMock = Substitute.For();
- using var scope = serviceProvider.CreateScope();
- httpContextAccessorMock.HttpContext = new DefaultHttpContext {RequestServices = scope.ServiceProvider};
-
- httpContextAccessorMock.HttpContext.Request.Host = new HostString("localhost", 5000);
- httpContextAccessorMock.HttpContext.Request.Scheme = "http";
-
- return httpContextAccessorMock;
- }
-
private ITestHarness CreateHarness()
{
var harness = ServiceProvider.GetTestHarness();
@@ -225,16 +212,4 @@ public class IntegrationTestFixture : IAsyncLifetime
{
return GrpcChannel.ForAddress(HttpClient.BaseAddress!, new GrpcChannelOptions {HttpClient = HttpClient});
}
-
- private async Task EnsureDatabaseAsync()
- {
- using var scope = ServiceProvider.CreateScope();
-
- var context = scope.ServiceProvider.GetRequiredService();
- var seeders = scope.ServiceProvider.GetServices();
-
- await context.Database.MigrateAsync();
-
- foreach (var seeder in seeders) await seeder.SeedAllAsync();
- }
}
diff --git a/src/Services/Flight/tests/IntegrationTest/CustomWebApplicationFactory.cs b/src/Services/Flight/tests/IntegrationTest/CustomWebApplicationFactory.cs
index 87db371..fcd1a13 100644
--- a/src/Services/Flight/tests/IntegrationTest/CustomWebApplicationFactory.cs
+++ b/src/Services/Flight/tests/IntegrationTest/CustomWebApplicationFactory.cs
@@ -55,15 +55,6 @@ public class CustomWebApplicationFactory : WebApplicationFactory
TestRegistrationServices?.Invoke(services);
});
-
- builder.UseDefaultServiceProvider((env, c) =>
- {
- // Handling Captive Dependency Problem
- // https://ankitvijay.net/2020/03/17/net-core-and-di-beware-of-captive-dependency/
- // https://blog.ploeh.dk/2014/06/02/captive-dependency/
- if (env.HostingEnvironment.IsEnvironment("test") || env.HostingEnvironment.IsDevelopment())
- c.ValidateScopes = true;
- });
}
private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
@@ -77,4 +68,4 @@ public class CustomWebApplicationFactory : WebApplicationFactory
return httpContextAccessorMock;
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/Flight/tests/IntegrationTest/IntegrationTestFixture.cs b/src/Services/Flight/tests/IntegrationTest/IntegrationTestFixture.cs
index 0bdc9d5..143318e 100644
--- a/src/Services/Flight/tests/IntegrationTest/IntegrationTestFixture.cs
+++ b/src/Services/Flight/tests/IntegrationTest/IntegrationTestFixture.cs
@@ -202,18 +202,6 @@ public class IntegrationTestFixture : IAsyncLifetime
});
}
- private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
- {
- var httpContextAccessorMock = Substitute.For();
- using var scope = serviceProvider.CreateScope();
- httpContextAccessorMock.HttpContext = new DefaultHttpContext {RequestServices = scope.ServiceProvider};
-
- httpContextAccessorMock.HttpContext.Request.Host = new HostString("localhost", 5000);
- httpContextAccessorMock.HttpContext.Request.Scheme = "http";
-
- return httpContextAccessorMock;
- }
-
private ITestHarness CreateHarness()
{
var harness = ServiceProvider.GetTestHarness();
@@ -225,16 +213,4 @@ public class IntegrationTestFixture : IAsyncLifetime
{
return GrpcChannel.ForAddress(HttpClient.BaseAddress!, new GrpcChannelOptions {HttpClient = HttpClient});
}
-
- private async Task EnsureDatabaseAsync()
- {
- using var scope = ServiceProvider.CreateScope();
-
- var context = scope.ServiceProvider.GetRequiredService();
- var seeders = scope.ServiceProvider.GetServices();
-
- await context.Database.MigrateAsync();
-
- foreach (var seeder in seeders) await seeder.SeedAllAsync();
- }
}
diff --git a/src/Services/Identity/tests/IntegrationTest/CustomWebApplicationFactory.cs b/src/Services/Identity/tests/IntegrationTest/CustomWebApplicationFactory.cs
index 87db371..fcd1a13 100644
--- a/src/Services/Identity/tests/IntegrationTest/CustomWebApplicationFactory.cs
+++ b/src/Services/Identity/tests/IntegrationTest/CustomWebApplicationFactory.cs
@@ -55,15 +55,6 @@ public class CustomWebApplicationFactory : WebApplicationFactory
TestRegistrationServices?.Invoke(services);
});
-
- builder.UseDefaultServiceProvider((env, c) =>
- {
- // Handling Captive Dependency Problem
- // https://ankitvijay.net/2020/03/17/net-core-and-di-beware-of-captive-dependency/
- // https://blog.ploeh.dk/2014/06/02/captive-dependency/
- if (env.HostingEnvironment.IsEnvironment("test") || env.HostingEnvironment.IsDevelopment())
- c.ValidateScopes = true;
- });
}
private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
@@ -77,4 +68,4 @@ public class CustomWebApplicationFactory : WebApplicationFactory
return httpContextAccessorMock;
}
-}
\ No newline at end of file
+}
diff --git a/src/Services/Identity/tests/IntegrationTest/IntegrationTestFixture.cs b/src/Services/Identity/tests/IntegrationTest/IntegrationTestFixture.cs
index ed7fdc9..53fd92f 100644
--- a/src/Services/Identity/tests/IntegrationTest/IntegrationTestFixture.cs
+++ b/src/Services/Identity/tests/IntegrationTest/IntegrationTestFixture.cs
@@ -202,18 +202,6 @@ public class IntegrationTestFixture : IAsyncLifetime
});
}
- private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
- {
- var httpContextAccessorMock = Substitute.For();
- using var scope = serviceProvider.CreateScope();
- httpContextAccessorMock.HttpContext = new DefaultHttpContext {RequestServices = scope.ServiceProvider};
-
- httpContextAccessorMock.HttpContext.Request.Host = new HostString("localhost", 5000);
- httpContextAccessorMock.HttpContext.Request.Scheme = "http";
-
- return httpContextAccessorMock;
- }
-
private ITestHarness CreateHarness()
{
var harness = ServiceProvider.GetTestHarness();
@@ -225,16 +213,4 @@ public class IntegrationTestFixture : IAsyncLifetime
{
return GrpcChannel.ForAddress(HttpClient.BaseAddress!, new GrpcChannelOptions {HttpClient = HttpClient});
}
-
- private async Task EnsureDatabaseAsync()
- {
- using var scope = ServiceProvider.CreateScope();
-
- var context = scope.ServiceProvider.GetRequiredService();
- var seeders = scope.ServiceProvider.GetServices();
-
- await context.Database.MigrateAsync();
-
- foreach (var seeder in seeders) await seeder.SeedAllAsync();
- }
}
diff --git a/src/Services/Passenger/src/Passenger.Api/Program.cs b/src/Services/Passenger/src/Passenger.Api/Program.cs
index e680c6d..2d1428c 100644
--- a/src/Services/Passenger/src/Passenger.Api/Program.cs
+++ b/src/Services/Passenger/src/Passenger.Api/Program.cs
@@ -8,7 +8,6 @@ using BuildingBlocks.Mapster;
using BuildingBlocks.MassTransit;
using BuildingBlocks.OpenTelemetry;
using BuildingBlocks.Swagger;
-using BuildingBlocks.Utils;
using BuildingBlocks.Web;
using Figgle;
using FluentValidation;
@@ -17,10 +16,8 @@ using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Passenger;
using Passenger.Data;
using Passenger.Extensions;
-using Passenger.Services;
using Prometheus;
using Serilog;
-using Server;
var builder = WebApplication.CreateBuilder(args);
var configuration = builder.Configuration;
@@ -41,8 +38,6 @@ builder.Services.AddValidatorsFromAssembly(typeof(PassengerRoot).Assembly);
builder.Services.AddCustomProblemDetails();
builder.Services.AddCustomMapster(typeof(PassengerRoot).Assembly);
builder.Services.AddHttpContextAccessor();
-builder.Services.AddScoped();
-
builder.Services.AddTransient();
builder.Services.AddCustomMassTransit(typeof(PassengerRoot).Assembly, env);
@@ -77,7 +72,6 @@ app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapMetrics();
- endpoints.MapGrpcService();
endpoints.MapMagicOnionService();
});
@@ -85,4 +79,6 @@ app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name));
app.Run();
-public partial class Program {}
+public partial class Program
+{
+}
diff --git a/src/Services/Passenger/src/Passenger/GrpcServer/PassengerGrpcService.cs b/src/Services/Passenger/src/Passenger/GrpcServer/PassengerGrpcService.cs
index 82b813b..3edd30f 100644
--- a/src/Services/Passenger/src/Passenger/GrpcServer/PassengerGrpcService.cs
+++ b/src/Services/Passenger/src/Passenger/GrpcServer/PassengerGrpcService.cs
@@ -21,9 +21,4 @@ public class PassengerGrpcService : ServiceBase, IPasseng
var result = await _mediator.Send(new GetPassengerQueryById(id));
return result.Adapt();
}
-
- public UnaryResult TTT(long id)
- {
- return new UnaryResult("hiiiiiiiiiiiiiiii");
- }
}
diff --git a/src/Services/Passenger/src/Passenger/Passenger.csproj b/src/Services/Passenger/src/Passenger/Passenger.csproj
index 4c8dce7..487d10d 100644
--- a/src/Services/Passenger/src/Passenger/Passenger.csproj
+++ b/src/Services/Passenger/src/Passenger/Passenger.csproj
@@ -6,13 +6,6 @@
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -22,18 +15,10 @@
-
-
-
-
- Protos\test.proto
-
-
-
diff --git a/src/Services/Passenger/src/Passenger/Protos/test.proto b/src/Services/Passenger/src/Passenger/Protos/test.proto
deleted file mode 100644
index 6a4b8cc..0000000
--- a/src/Services/Passenger/src/Passenger/Protos/test.proto
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2019 The gRPC Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-syntax = "proto3";
-
-package test;
-
-service Tester {
- rpc SayHelloUnary (HelloRequest) returns (HelloReply);
- rpc SayHelloServerStreaming (HelloRequest) returns (stream HelloReply);
- rpc SayHelloClientStreaming (stream HelloRequest) returns (HelloReply);
- rpc SayHelloBidirectionalStreaming (stream HelloRequest) returns (stream HelloReply);
-}
-
-message HelloRequest {
- string name = 1;
-}
-
-message HelloReply {
- string message = 1;
-}
diff --git a/src/Services/Passenger/src/Passenger/Services/Greeter.cs b/src/Services/Passenger/src/Passenger/Services/Greeter.cs
deleted file mode 100644
index 4f6d72f..0000000
--- a/src/Services/Passenger/src/Passenger/Services/Greeter.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#region Copyright notice and license
-
-// Copyright 2019 The gRPC Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#endregion
-
-using Microsoft.Extensions.Logging;
-
-namespace Server
-{
- public class Greeter : IGreeter
- {
- private readonly ILogger _logger;
-
- public Greeter(ILoggerFactory loggerFactory)
- {
- _logger = loggerFactory.CreateLogger();
- }
-
- public string Greet(string name)
- {
- _logger.LogInformation($"Creating greeting to {name}");
- return $"Hello {name}";
- }
- }
-}
diff --git a/src/Services/Passenger/src/Passenger/Services/IGreeter.cs b/src/Services/Passenger/src/Passenger/Services/IGreeter.cs
deleted file mode 100644
index e8cddf0..0000000
--- a/src/Services/Passenger/src/Passenger/Services/IGreeter.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-#region Copyright notice and license
-
-// Copyright 2019 The gRPC Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#endregion
-
-namespace Server
-{
- public interface IGreeter
- {
- string Greet(string name);
- }
-}
diff --git a/src/Services/Passenger/src/Passenger/Services/TesterService.cs b/src/Services/Passenger/src/Passenger/Services/TesterService.cs
deleted file mode 100644
index 296d2f8..0000000
--- a/src/Services/Passenger/src/Passenger/Services/TesterService.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using Grpc.Core;
-using Server;
-using Test;
-
-namespace Passenger.Services;
-
-public class TesterService: Tester.TesterBase
-{
- private readonly IGreeter _greeter;
-
- public TesterService(IGreeter greeter)
- {
- _greeter = greeter;
- }
-
- public override Task SayHelloUnary(HelloRequest request,
- ServerCallContext context)
- {
- var message = _greeter.Greet(request.Name);
- return Task.FromResult(new HelloReply { Message = message });
- }
-
- public override async Task SayHelloServerStreaming(HelloRequest request,
- IServerStreamWriter responseStream, ServerCallContext context)
- {
- var i = 0;
- while (!context.CancellationToken.IsCancellationRequested)
- {
- var message = _greeter.Greet($"{request.Name} {++i}");
- await responseStream.WriteAsync(new HelloReply { Message = message });
-
- await Task.Delay(1000);
- }
- }
-
- public override async Task SayHelloClientStreaming(
- IAsyncStreamReader requestStream, ServerCallContext context)
- {
- var names = new List();
-
- await foreach (var request in requestStream.ReadAllAsync())
- {
- names.Add(request.Name);
- }
-
- var message = _greeter.Greet(string.Join(", ", names));
- return new HelloReply { Message = message };
- }
-
- public override async Task SayHelloBidirectionalStreaming(
- IAsyncStreamReader requestStream,
- IServerStreamWriter responseStream,
- ServerCallContext context)
- {
- await foreach (var request in requestStream.ReadAllAsync())
- {
- await responseStream.WriteAsync(
- new HelloReply { Message = _greeter.Greet(request.Name) });
- }
- }
-}
diff --git a/src/Services/Passenger/tests/IntegrationTest/CustomWebApplicationFactory.cs b/src/Services/Passenger/tests/IntegrationTest/CustomWebApplicationFactory.cs
index fbb8936..90ee138 100644
--- a/src/Services/Passenger/tests/IntegrationTest/CustomWebApplicationFactory.cs
+++ b/src/Services/Passenger/tests/IntegrationTest/CustomWebApplicationFactory.cs
@@ -1,4 +1,5 @@
using System;
+using BuildingBlocks.Contracts.Grpc;
using BuildingBlocks.MassTransit;
using BuildingBlocks.Web;
using MassTransit;
@@ -49,19 +50,12 @@ public class CustomWebApplicationFactory : WebApplicationFactory
});
});
+ services.ReplaceServiceWithSingletonMock();
+
Checkpoint = new Checkpoint {TablesToIgnore = new[] {"__EFMigrationsHistory"}};
TestRegistrationServices?.Invoke(services);
});
-
- builder.UseDefaultServiceProvider((env, c) =>
- {
- // Handling Captive Dependency Problem
- // https://ankitvijay.net/2020/03/17/net-core-and-di-beware-of-captive-dependency/
- // https://blog.ploeh.dk/2014/06/02/captive-dependency/
- if (env.HostingEnvironment.IsEnvironment("test") || env.HostingEnvironment.IsDevelopment())
- c.ValidateScopes = true;
- });
}
private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
diff --git a/src/Services/Passenger/tests/IntegrationTest/Fakes/FakePassengerCreated.cs b/src/Services/Passenger/tests/IntegrationTest/Fakes/FakePassengerCreated.cs
index 1c04b6d..925d566 100644
--- a/src/Services/Passenger/tests/IntegrationTest/Fakes/FakePassengerCreated.cs
+++ b/src/Services/Passenger/tests/IntegrationTest/Fakes/FakePassengerCreated.cs
@@ -7,6 +7,6 @@ public static class FakePassengerCreated
{
public static global::Passenger.Passengers.Models.Passenger Generate(UserCreated userCreated)
{
- return global::Passenger.Passengers.Models.Passenger.Create(1000, userCreated.Name, userCreated.PassportNumber);
+ return global::Passenger.Passengers.Models.Passenger.Create(SnowFlakIdGenerator.NewId(), userCreated.Name, userCreated.PassportNumber);
}
}
diff --git a/src/Services/Passenger/tests/IntegrationTest/Fakes/FakePassengerResponseDto.cs b/src/Services/Passenger/tests/IntegrationTest/Fakes/FakePassengerResponseDto.cs
new file mode 100644
index 0000000..bbc46a7
--- /dev/null
+++ b/src/Services/Passenger/tests/IntegrationTest/Fakes/FakePassengerResponseDto.cs
@@ -0,0 +1,12 @@
+using AutoBogus;
+using Passenger.Passengers.Dtos;
+
+namespace Integration.Test.Fakes;
+
+public class FakePassengerResponseDto : AutoFaker
+{
+ public FakePassengerResponseDto(long id)
+ {
+ RuleFor(r => r.Id, _ => id);
+ }
+}
diff --git a/src/Services/Passenger/tests/IntegrationTest/Fakes/FakeUserCreated.cs b/src/Services/Passenger/tests/IntegrationTest/Fakes/FakeUserCreated.cs
index a0bc996..f53739e 100644
--- a/src/Services/Passenger/tests/IntegrationTest/Fakes/FakeUserCreated.cs
+++ b/src/Services/Passenger/tests/IntegrationTest/Fakes/FakeUserCreated.cs
@@ -8,7 +8,7 @@ public class FakeUserCreated : AutoFaker
{
public FakeUserCreated()
{
- RuleFor(r => r.Id, _ => _.Random.Number(50, 100000));
+ RuleFor(r => r.Id, _ => SnowFlakIdGenerator.NewId());
RuleFor(r => r.Name, _ => "Meysam");
RuleFor(r => r.PassportNumber, _ => "1299878");
}
diff --git a/src/Services/Passenger/tests/IntegrationTest/IntegrationTestFixture.cs b/src/Services/Passenger/tests/IntegrationTest/IntegrationTestFixture.cs
index 1fadc44..a908460 100644
--- a/src/Services/Passenger/tests/IntegrationTest/IntegrationTestFixture.cs
+++ b/src/Services/Passenger/tests/IntegrationTest/IntegrationTestFixture.cs
@@ -1,15 +1,23 @@
using System;
+using System.Linq;
using System.Net.Http;
+using System.Reflection;
+using System.Security.Cryptography;
using System.Threading.Tasks;
using BuildingBlocks.Domain.Model;
using BuildingBlocks.EFCore;
+using Grpc.Core;
using Grpc.Net.Client;
+using MagicOnion;
+using MagicOnion.Client;
+using MagicOnion.Server;
using MassTransit.Testing;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
+using Moq;
using NSubstitute;
using Passenger.Data;
using Serilog;
@@ -202,18 +210,6 @@ public class IntegrationTestFixture : IAsyncLifetime
});
}
- private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
- {
- var httpContextAccessorMock = Substitute.For();
- using var scope = serviceProvider.CreateScope();
- httpContextAccessorMock.HttpContext = new DefaultHttpContext {RequestServices = scope.ServiceProvider};
-
- httpContextAccessorMock.HttpContext.Request.Host = new HostString("localhost", 5000);
- httpContextAccessorMock.HttpContext.Request.Scheme = "http";
-
- return httpContextAccessorMock;
- }
-
private ITestHarness CreateHarness()
{
var harness = ServiceProvider.GetTestHarness();
@@ -225,16 +221,4 @@ public class IntegrationTestFixture : IAsyncLifetime
{
return GrpcChannel.ForAddress(HttpClient.BaseAddress!, new GrpcChannelOptions {HttpClient = HttpClient});
}
-
- private async Task EnsureDatabaseAsync()
- {
- using var scope = ServiceProvider.CreateScope();
-
- var context = scope.ServiceProvider.GetRequiredService();
- var seeders = scope.ServiceProvider.GetServices();
-
- await context.Database.MigrateAsync();
-
- foreach (var seeder in seeders) await seeder.SeedAllAsync();
- }
}
diff --git a/src/Services/Passenger/tests/IntegrationTest/Passenger/Features/GetPassengerByIdTests.cs b/src/Services/Passenger/tests/IntegrationTest/Passenger/Features/GetPassengerByIdTests.cs
index 4bb534d..2d60cb4 100644
--- a/src/Services/Passenger/tests/IntegrationTest/Passenger/Features/GetPassengerByIdTests.cs
+++ b/src/Services/Passenger/tests/IntegrationTest/Passenger/Features/GetPassengerByIdTests.cs
@@ -1,22 +1,12 @@
-using System;
-using System.Threading.Channels;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using BuildingBlocks.Contracts.EventBus.Messages;
using BuildingBlocks.Contracts.Grpc;
-using BuildingBlocks.IdsGenerator;
using FluentAssertions;
-using Grpc.Core;
using Grpc.Net.Client;
using Integration.Test.Fakes;
-using MagicOnion;
using MagicOnion.Client;
using MassTransit.Testing;
-using Microsoft.Extensions.DependencyInjection;
-using Moq;
-using NSubstitute;
using Passenger.Passengers.Features.GetPassengerById;
-using Server;
-using Test;
using Xunit;
namespace Integration.Test.Passenger.Features;
@@ -25,24 +15,12 @@ namespace Integration.Test.Passenger.Features;
public class GetPassengerByIdTests
{
private readonly IntegrationTestFixture _fixture;
- private readonly GrpcChannel _channel;
private readonly ITestHarness _testHarness;
- private IPassengerGrpcService _passengerGrpcService;
+ private readonly GrpcChannel _channel;
public GetPassengerByIdTests(IntegrationTestFixture fixture)
{
_fixture = fixture;
- var mockGreeter = Substitute.For();
-
- mockGreeter.Greet(Arg.Any())
- .Returns("heyyyyyyyyyyyyyyy");
-
-
- _fixture.RegisterTestServices(services =>
- {
- services.AddSingleton(mockGreeter);
- });
-
_testHarness = _fixture.TestHarness;
_channel = _fixture.Channel;
}
@@ -67,7 +45,6 @@ public class GetPassengerByIdTests
response?.Id.Should().Be(passengerEntity.Id);
}
-
[Fact]
public async Task should_retrive_a_passenger_by_id_from_grpc_service()
{
@@ -87,18 +64,4 @@ public class GetPassengerByIdTests
response?.Should().NotBeNull();
response?.Id.Should().Be(passengerEntity.Id);
}
-
- [Fact]
- public async Task should_retrive_a_passenger_by_id_from_grpc_service_2()
- {
- // Arrange
- var client = new Tester.TesterClient(_fixture.Channel);
-
- // Act
- var response = await client.SayHelloUnaryAsync(
- new HelloRequest {Name = "Joe"});
-
- // Assert
- Assert.Equal("heyyyyyyyyyyyyyyy", response.Message);
- }
}