forked from ddrilling/AsbCloudServer
Merge branch 'dev' into fix/24509912-wellOperations-date-difference
This commit is contained in:
commit
eb0b99f6f1
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using AsbCloudApp.Data.User;
|
||||
using System;
|
||||
|
||||
namespace AsbCloudApp.Data;
|
||||
|
||||
@ -13,14 +14,14 @@ public abstract class ChangeLogAbstract
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Автор изменения
|
||||
/// Автор
|
||||
/// </summary>
|
||||
public int IdAuthor { get; set; }
|
||||
public UserDto? Author { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Редактор
|
||||
/// Автор
|
||||
/// </summary>
|
||||
public int? IdEditor { get; set; }
|
||||
public UserDto? Editor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дата создания записи
|
||||
|
@ -105,6 +105,8 @@ public class ProcessMapPlanBaseRepository<TDto, TEntity> : IProcessMapPlanBaseRe
|
||||
|
||||
var query = context
|
||||
.Set<TEntity>()
|
||||
.Include(e => e.Author)
|
||||
.Include(e => e.Editor)
|
||||
.Where(e => e.IdWell == idWell);
|
||||
|
||||
if(request.IdWellSectionType.HasValue)
|
||||
@ -133,6 +135,8 @@ public class ProcessMapPlanBaseRepository<TDto, TEntity> : IProcessMapPlanBaseRe
|
||||
{
|
||||
var query = context
|
||||
.Set<TEntity>()
|
||||
.Include(e => e.Author)
|
||||
.Include(e => e.Editor)
|
||||
.Where(e => e.IdWell == idWell);
|
||||
|
||||
var timezone = wellService.GetTimezone(idWell);
|
||||
|
@ -15,8 +15,6 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
private IProcessMapPlanDrillingClient client;
|
||||
private readonly ProcessMapPlanDrillingDto dto = new (){
|
||||
Id = 0,
|
||||
IdAuthor = 0,
|
||||
IdEditor = null,
|
||||
Creation = new(),
|
||||
Obsolete = null,
|
||||
IdState = 0,
|
||||
@ -109,7 +107,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.IdState),
|
||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
||||
nameof(ProcessMapPlanDrillingDto.Author),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
};
|
||||
MatchHelper.Match(expected, actual, excludeProps);
|
||||
@ -251,9 +249,11 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
|
||||
var expected = dtoCopy.Adapt<ProcessMapPlanDrilling>();
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
nameof(ProcessMapPlanDrilling.Id),
|
||||
nameof(ProcessMapPlanDrilling.Author),
|
||||
nameof(ProcessMapPlanDrilling.IdAuthor),
|
||||
nameof(ProcessMapPlanDrilling.Editor),
|
||||
nameof(ProcessMapPlanDrilling.Creation),
|
||||
};
|
||||
MatchHelper.Match(expected, newEntity!, excludeProps);
|
||||
}
|
||||
@ -377,7 +377,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
var expected = entity.Adapt<ProcessMapPlanDrillingDto>()!;
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
||||
nameof(ProcessMapPlanDrillingDto.Author),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
};
|
||||
MatchHelper.Match(expected, actual, excludeProps);
|
||||
@ -453,7 +453,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>()!;
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
||||
nameof(ProcessMapPlanDrillingDto.Author),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
};
|
||||
MatchHelper.Match(expected, actual, excludeProps);
|
||||
@ -501,7 +501,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
||||
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>();
|
||||
var excludeProps = new[] {
|
||||
nameof(ProcessMapPlanDrillingDto.Id),
|
||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
||||
nameof(ProcessMapPlanDrillingDto.Author),
|
||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||
};
|
||||
MatchHelper.Match(expected, actual, excludeProps);
|
||||
|
@ -8,12 +8,13 @@ public static class MatchHelper
|
||||
public static void Match<T>(T expected, T actual, IEnumerable<string>? excludeProps = null)
|
||||
{
|
||||
if (ReferenceEquals(expected, actual))
|
||||
throw EqualException.ForMismatchedValues(expected, actual);
|
||||
throw EqualException.ForMismatchedValues(expected, actual, "Reference are equals");
|
||||
|
||||
if (expected is null || actual is null)
|
||||
throw EqualException.ForMismatchedValues(expected, actual);
|
||||
|
||||
var props = typeof(T).GetProperties(
|
||||
var type = typeof(T);
|
||||
var props = type.GetProperties(
|
||||
BindingFlags.Public
|
||||
| BindingFlags.Instance).Where(prop => prop.CanWrite);
|
||||
|
||||
@ -25,7 +26,10 @@ public static class MatchHelper
|
||||
var objValue = prop.GetValue(expected);
|
||||
var anotherValue = prop.GetValue(actual);
|
||||
if (objValue != null && !objValue.Equals(anotherValue))
|
||||
throw EqualException.ForMismatchedValues(expected, actual);
|
||||
{
|
||||
var banner = $" of {type.Name} props {prop.Name} ";
|
||||
throw EqualException.ForMismatchedValues(expected, actual, banner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user