Автотесты

This commit is contained in:
Olga Nemt 2024-05-21 07:12:22 +03:00
parent 6af038496c
commit 832489b9ac
7 changed files with 575 additions and 638 deletions

View File

@ -8,12 +8,6 @@ namespace AsbCloudApp.Requests;
/// </summary>
public class ProcessMapPlanBaseRequest: ChangeLogBaseRequest
{
/// <summary>
/// Тип секции
/// </summary>
[Range(1, int.MaxValue, ErrorMessage = "Id секции - положительное число")]
public int? IdWellSectionType { get; set; }
/// <summary>
/// Вернуть данные, которые поменялись с указанной даты
/// </summary>
@ -42,7 +36,6 @@ public class ProcessMapPlanBaseRequestWithWell: ProcessMapPlanBaseRequest
public ProcessMapPlanBaseRequestWithWell(ProcessMapPlanBaseRequest request, int idWell)
{
IdWell=idWell;
IdWellSectionType=request.IdWellSectionType;
UpdateFrom = request.UpdateFrom;
Moment = request.Moment;
}

View File

@ -134,9 +134,9 @@ namespace AsbCloudInfrastructure
TypeAdapterConfig<ChangeLogAbstract, ChangeLogDto<ProcessMapPlanDrillingDto>>.NewConfig()
.Include<ProcessMapPlanDrilling, ChangeLogDto<ProcessMapPlanDrillingDto>>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanDrilling>()
.Map(dest => dest, src => new ChangeLogDto<ProcessMapPlanDrillingDto>()
{
Item = src.Adapt<ProcessMapPlanDrilling>()
Item = src.Adapt<ProcessMapPlanDrillingDto>()
});
}

View File

@ -249,6 +249,7 @@ public abstract class ChangeLogRepositoryAbstract<TDto, TEntity, TRequest> : ICh
{
var query = BuildQuery(request);
var entities = await query
.Where(e => e.Obsolete == null)
.OrderBy(e => e.Creation)
.ThenBy(e => e.Obsolete)
.ThenBy(e => e.Id)

View File

@ -32,9 +32,6 @@ public class ProcessMapPlanBaseRepository<TDto, TEntity> : ChangeLogRepositoryAb
.Include(e => e.WellSectionType)
.Where(e => e.IdWell == request.IdWell);
if (request.IdWellSectionType.HasValue)
query = query.Where(e => e.IdWellSectionType == request.IdWellSectionType);
if (request.UpdateFrom.HasValue)
{
var from = request.UpdateFrom.Value.ToUniversalTime();

View File

@ -5,15 +5,15 @@ using Refit;
namespace AsbCloudWebApi.IntegrationTests.Clients;
public interface IProcessMapPlanDrillingClient
public interface IProcessMapPlanDrillingClient<TDto> where TDto : ProcessMapPlanBaseDto
{
private const string BaseRoute = "/api/well/{idWell}/ProcessMapPlanDrilling";
[Post(BaseRoute)]
Task<IApiResponse<int>> InsertRange(int idWell, [Body] IEnumerable<ProcessMapPlanDrillingDto> dtos);
Task<IApiResponse<int>> InsertRange(int idWell, [Body] IEnumerable<TDto> dtos);
[Post($"{BaseRoute}/replace")]
Task<IApiResponse<int>> ClearAndInsertRange(int idWell, [Body] IEnumerable<ProcessMapPlanDrillingDto> dtos);
Task<IApiResponse<int>> ClearAndInsertRange(int idWell, [Body] IEnumerable<TDto> dtos);
[Delete(BaseRoute)]
Task<IApiResponse<int>> DeleteRange(int idWell, [Body] IEnumerable<int> ids);
@ -22,18 +22,24 @@ public interface IProcessMapPlanDrillingClient
Task<IApiResponse<int>> Clear(int idWell);
[Get(BaseRoute)]
Task<IApiResponse<IEnumerable<ProcessMapPlanDrillingDto>>> Get(int idWell, ProcessMapPlanBaseRequest request);
Task<IApiResponse<IEnumerable<TDto>>> Get(int idWell);
[Get($"{BaseRoute}/history")]
Task<IApiResponse<IEnumerable<ChangeLogDto<TDto>>>> Get(int idWell, DateTimeOffset? moment);
[Get("/api/telemetry/{uid}/ProcessMapPlanDrilling")]
Task<IApiResponse<IEnumerable<ChangeLogDto<TDto>>>> Get(string uid, DateTimeOffset? updateFrom);
[Get($"{BaseRoute}/changeLog")]
Task<IApiResponse<IEnumerable<ProcessMapPlanDrillingDto>>> GetChangeLog(int idWell, DateOnly? date);
Task<IApiResponse<IEnumerable<TDto>>> GetChangeLog(int idWell, DateOnly? date);
[Get($"{BaseRoute}/dates")]
Task<IApiResponse<IEnumerable<DateOnly>>> GetDatesChange(int idWell);
[Put(BaseRoute)]
Task<IApiResponse<int>> UpdateOrInsertRange(int idWell, IEnumerable<ProcessMapPlanDrillingDto> dtos);
Task<IApiResponse<int>> UpdateOrInsertRange(int idWell, IEnumerable<TDto> dtos);
[Multipart]
[Post(BaseRoute + "/parse")]
Task<IApiResponse<ParserResultDto<ProcessMapPlanDrillingDto>>> Parse(int idWell, [AliasAs("file")] StreamPart stream);
Task<IApiResponse<ParserResultDto<TDto>>> Parse(int idWell, [AliasAs("file")] StreamPart stream);
}

View File

@ -11,6 +11,8 @@ namespace AsbCloudWebApi.IntegrationTests.Data
Hours = 1
};
public static string RemoteUid = "555-555-555";
public static Deposit[] Deposits => new Deposit[]
{
new()
@ -39,7 +41,7 @@ namespace AsbCloudWebApi.IntegrationTests.Data
Timezone = Timezone,
Telemetry = new Telemetry
{
RemoteUid = "555-555-555",
RemoteUid = RemoteUid,
TimeZone = Timezone
},
RelationCompaniesWells = new RelationCompanyWell[]