mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-05-06 22:07:53 +08:00
refactor unit test
This commit is contained in:
parent
a7a1f1a81d
commit
ed931ae0f2
@ -2,6 +2,7 @@ namespace Flight.Aircrafts.Dtos;
|
|||||||
|
|
||||||
public record AircraftResponseDto
|
public record AircraftResponseDto
|
||||||
{
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
public string Name { get; init; }
|
public string Name { get; init; }
|
||||||
public string Model { get; init; }
|
public string Model { get; init; }
|
||||||
public int ManufacturingYear { get; init; }
|
public int ManufacturingYear { get; init; }
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
namespace Flight.Airports.Dtos;
|
namespace Flight.Airports.Dtos;
|
||||||
public record AirportResponseDto
|
public record AirportResponseDto
|
||||||
{
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
public string Name { get; init; }
|
public string Name { get; init; }
|
||||||
public string Address { get; init; }
|
public string Address { get; init; }
|
||||||
public string Code { get; init; }
|
public string Code { get; init; }
|
||||||
|
|||||||
@ -36,10 +36,10 @@ public class CreateAircraftCommandHandlerTests
|
|||||||
var response = await Act(command, CancellationToken.None);
|
var response = await Act(command, CancellationToken.None);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var entity = await _fixture.DbContext.Aircraft.SingleOrDefaultAsync(x => x.Model == response.Model);
|
var entity = await _fixture.DbContext.Aircraft.FindAsync(response?.Id);
|
||||||
|
|
||||||
entity?.Should().NotBeNull();
|
entity?.Should().NotBeNull();
|
||||||
response?.Model.Should().Be(entity?.Model);
|
response?.Id.Should().Be(entity?.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@ -37,10 +37,10 @@ public class CreateAirportCommandHandlerTests
|
|||||||
var response = await Act(command, CancellationToken.None);
|
var response = await Act(command, CancellationToken.None);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var entity = await _fixture.DbContext.Airports.SingleOrDefaultAsync(x => x.Code == response.Code);
|
var entity = await _fixture.DbContext.Airports.FindAsync(response?.Id);
|
||||||
|
|
||||||
entity?.Should().NotBeNull();
|
entity?.Should().NotBeNull();
|
||||||
response?.Code.Should().Be(entity?.Code);
|
response?.Id.Should().Be(entity?.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@ -39,6 +39,7 @@ public class CreateFlightCommandHandlerTests
|
|||||||
|
|
||||||
entity?.Should().NotBeNull();
|
entity?.Should().NotBeNull();
|
||||||
response?.Id.Should().Be(entity?.Id);
|
response?.Id.Should().Be(entity?.Id);
|
||||||
|
response?.FlightNumber.Should().Be(entity?.FlightNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class CreateSeatCommandHandlerTests
|
|||||||
var response = await Act(command, CancellationToken.None);
|
var response = await Act(command, CancellationToken.None);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var entity = await _fixture.DbContext.Seats.SingleOrDefaultAsync(x => x.SeatNumber == response.SeatNumber);
|
var entity = await _fixture.DbContext.Seats.FindAsync(response?.Id);
|
||||||
|
|
||||||
entity?.Should().NotBeNull();
|
entity?.Should().NotBeNull();
|
||||||
response?.Id.Should().Be(entity?.Id);
|
response?.Id.Should().Be(entity?.Id);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user