mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-27 08:00:52 +08:00
change in create new flight test
This commit is contained in:
parent
66e7236411
commit
1971267b8e
@ -18,7 +18,7 @@ public class CreateFlightTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task should_create_new_flight_to_db()
|
public async Task should_create_new_flight_to_db_and_publish_message_to_broker()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var fakeFlight = new FakeCreateFlightCommand().Generate();
|
var fakeFlight = new FakeCreateFlightCommand().Generate();
|
||||||
@ -33,6 +33,7 @@ public class CreateFlightTest
|
|||||||
// Assert
|
// Assert
|
||||||
flightResponse.Should().NotBeNull();
|
flightResponse.Should().NotBeNull();
|
||||||
flightResponse?.FlightNumber.Should().Be(command.FlightNumber);
|
flightResponse?.FlightNumber.Should().Be(command.FlightNumber);
|
||||||
(await _fixture.IsConsumed<FlightCreated>()).Should().Be(true);
|
(await _fixture.IsFaultyPublished<FlightCreated>()).Should().BeFalse();
|
||||||
|
(await _fixture.IsPublished<FlightCreated>()).Should().BeTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,8 +59,6 @@ public class TestFixture : IAsyncLifetime
|
|||||||
services.ReplaceScoped<IDataSeeder, FlightDataSeeder>();
|
services.ReplaceScoped<IDataSeeder, FlightDataSeeder>();
|
||||||
services.AddMassTransitTestHarness(x =>
|
services.AddMassTransitTestHarness(x =>
|
||||||
{
|
{
|
||||||
x.AddConsumer<FlightConsumer>();
|
|
||||||
|
|
||||||
x.UsingRabbitMq((context, cfg) =>
|
x.UsingRabbitMq((context, cfg) =>
|
||||||
{
|
{
|
||||||
var rabbitMqOptions = services.GetOptions<RabbitMqOptions>("RabbitMq");
|
var rabbitMqOptions = services.GetOptions<RabbitMqOptions>("RabbitMq");
|
||||||
@ -74,8 +72,6 @@ public class TestFixture : IAsyncLifetime
|
|||||||
cfg.ConfigureEndpoints(context);
|
cfg.ConfigureEndpoints(context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//FlightConsumer
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
_harness = _factory.Services.GetTestHarness();
|
_harness = _factory.Services.GetTestHarness();
|
||||||
@ -312,12 +308,6 @@ public class TestFixture : IAsyncLifetime
|
|||||||
foreach (var seeder in seeders) await seeder.SeedAllAsync();
|
foreach (var seeder in seeders) await seeder.SeedAllAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// private async Task AddInMemoryHarnessAsync()
|
|
||||||
// {
|
|
||||||
// _harness = _factory.Services.GetRequiredService<InMemoryTestHarness>();
|
|
||||||
// await _harness.Start();
|
|
||||||
// }
|
|
||||||
|
|
||||||
private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
|
private IHttpContextAccessor AddHttpContextAccessorMock(IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
var httpContextAccessorMock = Substitute.For<IHttpContextAccessor>();
|
var httpContextAccessorMock = Substitute.For<IHttpContextAccessor>();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user