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;
|
namespace AsbCloudApp.Data;
|
||||||
|
|
||||||
@ -13,14 +14,14 @@ public abstract class ChangeLogAbstract
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Автор изменения
|
/// Автор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int IdAuthor { get; set; }
|
public UserDto? Author { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Редактор
|
/// Автор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? IdEditor { get; set; }
|
public UserDto? Editor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Дата создания записи
|
/// Дата создания записи
|
||||||
|
@ -105,6 +105,8 @@ public class ProcessMapPlanBaseRepository<TDto, TEntity> : IProcessMapPlanBaseRe
|
|||||||
|
|
||||||
var query = context
|
var query = context
|
||||||
.Set<TEntity>()
|
.Set<TEntity>()
|
||||||
|
.Include(e => e.Author)
|
||||||
|
.Include(e => e.Editor)
|
||||||
.Where(e => e.IdWell == idWell);
|
.Where(e => e.IdWell == idWell);
|
||||||
|
|
||||||
if(request.IdWellSectionType.HasValue)
|
if(request.IdWellSectionType.HasValue)
|
||||||
@ -133,6 +135,8 @@ public class ProcessMapPlanBaseRepository<TDto, TEntity> : IProcessMapPlanBaseRe
|
|||||||
{
|
{
|
||||||
var query = context
|
var query = context
|
||||||
.Set<TEntity>()
|
.Set<TEntity>()
|
||||||
|
.Include(e => e.Author)
|
||||||
|
.Include(e => e.Editor)
|
||||||
.Where(e => e.IdWell == idWell);
|
.Where(e => e.IdWell == idWell);
|
||||||
|
|
||||||
var timezone = wellService.GetTimezone(idWell);
|
var timezone = wellService.GetTimezone(idWell);
|
||||||
|
@ -15,8 +15,6 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
|||||||
private IProcessMapPlanDrillingClient client;
|
private IProcessMapPlanDrillingClient client;
|
||||||
private readonly ProcessMapPlanDrillingDto dto = new (){
|
private readonly ProcessMapPlanDrillingDto dto = new (){
|
||||||
Id = 0,
|
Id = 0,
|
||||||
IdAuthor = 0,
|
|
||||||
IdEditor = null,
|
|
||||||
Creation = new(),
|
Creation = new(),
|
||||||
Obsolete = null,
|
Obsolete = null,
|
||||||
IdState = 0,
|
IdState = 0,
|
||||||
@ -109,7 +107,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
|||||||
var excludeProps = new[] {
|
var excludeProps = new[] {
|
||||||
nameof(ProcessMapPlanDrillingDto.Id),
|
nameof(ProcessMapPlanDrillingDto.Id),
|
||||||
nameof(ProcessMapPlanDrillingDto.IdState),
|
nameof(ProcessMapPlanDrillingDto.IdState),
|
||||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
nameof(ProcessMapPlanDrillingDto.Author),
|
||||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||||
};
|
};
|
||||||
MatchHelper.Match(expected, actual, excludeProps);
|
MatchHelper.Match(expected, actual, excludeProps);
|
||||||
@ -251,9 +249,11 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
|||||||
|
|
||||||
var expected = dtoCopy.Adapt<ProcessMapPlanDrilling>();
|
var expected = dtoCopy.Adapt<ProcessMapPlanDrilling>();
|
||||||
var excludeProps = new[] {
|
var excludeProps = new[] {
|
||||||
nameof(ProcessMapPlanDrillingDto.Id),
|
nameof(ProcessMapPlanDrilling.Id),
|
||||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
nameof(ProcessMapPlanDrilling.Author),
|
||||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
nameof(ProcessMapPlanDrilling.IdAuthor),
|
||||||
|
nameof(ProcessMapPlanDrilling.Editor),
|
||||||
|
nameof(ProcessMapPlanDrilling.Creation),
|
||||||
};
|
};
|
||||||
MatchHelper.Match(expected, newEntity!, excludeProps);
|
MatchHelper.Match(expected, newEntity!, excludeProps);
|
||||||
}
|
}
|
||||||
@ -377,7 +377,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
|||||||
var expected = entity.Adapt<ProcessMapPlanDrillingDto>()!;
|
var expected = entity.Adapt<ProcessMapPlanDrillingDto>()!;
|
||||||
var excludeProps = new[] {
|
var excludeProps = new[] {
|
||||||
nameof(ProcessMapPlanDrillingDto.Id),
|
nameof(ProcessMapPlanDrillingDto.Id),
|
||||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
nameof(ProcessMapPlanDrillingDto.Author),
|
||||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||||
};
|
};
|
||||||
MatchHelper.Match(expected, actual, excludeProps);
|
MatchHelper.Match(expected, actual, excludeProps);
|
||||||
@ -453,7 +453,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
|||||||
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>()!;
|
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>()!;
|
||||||
var excludeProps = new[] {
|
var excludeProps = new[] {
|
||||||
nameof(ProcessMapPlanDrillingDto.Id),
|
nameof(ProcessMapPlanDrillingDto.Id),
|
||||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
nameof(ProcessMapPlanDrillingDto.Author),
|
||||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||||
};
|
};
|
||||||
MatchHelper.Match(expected, actual, excludeProps);
|
MatchHelper.Match(expected, actual, excludeProps);
|
||||||
@ -501,7 +501,7 @@ public class ProcessMapPlanDrillingControllerTest: BaseIntegrationTest
|
|||||||
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>();
|
var expected = entity2.Adapt<ProcessMapPlanDrillingDto>();
|
||||||
var excludeProps = new[] {
|
var excludeProps = new[] {
|
||||||
nameof(ProcessMapPlanDrillingDto.Id),
|
nameof(ProcessMapPlanDrillingDto.Id),
|
||||||
nameof(ProcessMapPlanDrillingDto.IdAuthor),
|
nameof(ProcessMapPlanDrillingDto.Author),
|
||||||
nameof(ProcessMapPlanDrillingDto.Creation),
|
nameof(ProcessMapPlanDrillingDto.Creation),
|
||||||
};
|
};
|
||||||
MatchHelper.Match(expected, actual, excludeProps);
|
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)
|
public static void Match<T>(T expected, T actual, IEnumerable<string>? excludeProps = null)
|
||||||
{
|
{
|
||||||
if (ReferenceEquals(expected, actual))
|
if (ReferenceEquals(expected, actual))
|
||||||
throw EqualException.ForMismatchedValues(expected, actual);
|
throw EqualException.ForMismatchedValues(expected, actual, "Reference are equals");
|
||||||
|
|
||||||
if (expected is null || actual is null)
|
if (expected is null || actual is null)
|
||||||
throw EqualException.ForMismatchedValues(expected, actual);
|
throw EqualException.ForMismatchedValues(expected, actual);
|
||||||
|
|
||||||
var props = typeof(T).GetProperties(
|
var type = typeof(T);
|
||||||
|
var props = type.GetProperties(
|
||||||
BindingFlags.Public
|
BindingFlags.Public
|
||||||
| BindingFlags.Instance).Where(prop => prop.CanWrite);
|
| BindingFlags.Instance).Where(prop => prop.CanWrite);
|
||||||
|
|
||||||
@ -25,7 +26,10 @@ public static class MatchHelper
|
|||||||
var objValue = prop.GetValue(expected);
|
var objValue = prop.GetValue(expected);
|
||||||
var anotherValue = prop.GetValue(actual);
|
var anotherValue = prop.GetValue(actual);
|
||||||
if (objValue != null && !objValue.Equals(anotherValue))
|
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