правка интеграционных тестов
This commit is contained in:
parent
8d2a22a38f
commit
e826a386d2
@ -66,20 +66,18 @@ public interface IChangeLogClient
|
||||
/// <summary>
|
||||
/// Обновить одну запись
|
||||
/// </summary>
|
||||
/// <param name="idDiscriminator"></param>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[Put($"{BaseRoute}/{{idDiscriminator}}")]
|
||||
Task<IApiResponse<int>> Update(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto);
|
||||
[Put($"{BaseRoute}")]
|
||||
Task<IApiResponse<int>> Update(DataWithWellDepthAndSectionDto dto);
|
||||
|
||||
/// <summary>
|
||||
/// Обновить несколько записей
|
||||
/// </summary>
|
||||
/// <param name="idDiscriminator"></param>
|
||||
/// <param name="dtos"></param>
|
||||
/// <returns></returns>
|
||||
[Put($"{BaseRoute}/range/{{idDiscriminator}}")]
|
||||
Task<IApiResponse<int>> UpdateRange(Guid idDiscriminator, IEnumerable<DataWithWellDepthAndSectionDto> dtos);
|
||||
[Put($"{BaseRoute}/range")]
|
||||
Task<IApiResponse<int>> UpdateRange(IEnumerable<DataWithWellDepthAndSectionDto> dtos);
|
||||
|
||||
/// <summary>
|
||||
/// Удалить одну запись
|
||||
@ -102,7 +100,7 @@ public interface IChangeLogClient
|
||||
/// </summary>
|
||||
/// <param name="idDiscriminator"></param>
|
||||
/// <returns></returns>
|
||||
[Get($"{BaseRoute}/datesRange")]
|
||||
[Get($"{BaseRoute}/datesRange/{{idDiscriminator}}")]
|
||||
Task<IApiResponse<DatesRangeDto?>> GetDatesRange(Guid idDiscriminator);
|
||||
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
||||
dto.DepthEnd = dto.DepthEnd + 10;
|
||||
|
||||
// act
|
||||
result = await client.Update(idDiscriminator, dto);
|
||||
result = await client.Update(dto);
|
||||
|
||||
// assert
|
||||
Assert.Equal(HttpStatusCode.OK, result.StatusCode);
|
||||
@ -143,7 +143,6 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
||||
{
|
||||
// arrange
|
||||
var count = 2;
|
||||
var idDiscriminator = Guid.NewGuid();
|
||||
var dtos = Generate(count, DateTimeOffset.UtcNow);
|
||||
var entities = dtos.Select(d => d.Adapt<ChangeLog>()).ToArray();
|
||||
dbContext.ChangeLog.AddRange(entities);
|
||||
@ -159,7 +158,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
||||
}).ToArray();
|
||||
|
||||
// act
|
||||
var result = await client.UpdateRange(idDiscriminator, dtos);
|
||||
var result = await client.UpdateRange(dtos);
|
||||
|
||||
// assert
|
||||
Assert.Equal(HttpStatusCode.OK, result.StatusCode);
|
||||
@ -298,7 +297,7 @@ public class ChangeLogControllerTest : BaseIntegrationTest
|
||||
entity.DepthEnd = entity.DepthEnd + 10;
|
||||
}
|
||||
var dtos = entities.Select(e => e.Adapt<DataWithWellDepthAndSectionDto>()).ToArray();
|
||||
await client.UpdateRange(idDiscriminator, dtos);
|
||||
await client.UpdateRange(dtos);
|
||||
|
||||
//act
|
||||
var dateBegin = DateTimeOffset.UtcNow.AddDays(daysBeforeNowFilter);
|
||||
|
@ -241,7 +241,9 @@ public class ChangeLogRepository : IChangeLogRepository
|
||||
.Select(group => new
|
||||
{
|
||||
Min = group.Min(e => e.Creation),
|
||||
Max = group.Max(e => (e.Creation > e.Obsolete ? e.Creation : e.Obsolete!.Value)),
|
||||
Max = group.Max(e => (e.Obsolete.HasValue && e.Obsolete > e.Creation)
|
||||
? e.Obsolete.Value
|
||||
: e.Creation),
|
||||
});
|
||||
|
||||
var values = await query.FirstOrDefaultAsync(token);
|
||||
|
Loading…
Reference in New Issue
Block a user