|
|
|
@ -6,6 +6,7 @@ using System.Threading.Tasks; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions; |
|
|
|
using NSubstitute; |
|
|
|
using Shouldly; |
|
|
|
using Volo.Abp.Auditing.App.Entities; |
|
|
|
using Volo.Abp.Data; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
@ -911,6 +912,76 @@ public class Auditing_Tests : AbpAuditingTestBase |
|
|
|
AuditingStore.ClearReceivedCalls(); |
|
|
|
#pragma warning restore 4014
|
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Not_Update_Modification_Audit_Properties_When_Only_Disabled_Complex_Property_Changes() |
|
|
|
{ |
|
|
|
var entityId = Guid.NewGuid(); |
|
|
|
var repository = ServiceProvider.GetRequiredService<IBasicRepository<AppEntityWithComplexProperty, Guid>>(); |
|
|
|
|
|
|
|
using (var uow = _unitOfWorkManager.Begin()) |
|
|
|
{ |
|
|
|
var entity = new AppEntityWithComplexProperty(entityId, "Test Entity") |
|
|
|
{ |
|
|
|
ContactInformation = new AppEntityContactInformation |
|
|
|
{ |
|
|
|
Street = "First Street", |
|
|
|
Location = new AppEntityContactLocation |
|
|
|
{ |
|
|
|
City = "First City" |
|
|
|
} |
|
|
|
}, |
|
|
|
DisabledContactInformation = new AppEntityContactInformation |
|
|
|
{ |
|
|
|
Street = "Disabled Street", |
|
|
|
Location = new AppEntityContactLocation |
|
|
|
{ |
|
|
|
City = "Disabled City" |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
await repository.InsertAsync(entity); |
|
|
|
|
|
|
|
await uow.CompleteAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
using (var uow = _unitOfWorkManager.Begin()) |
|
|
|
{ |
|
|
|
var entity = await repository.GetAsync(entityId); |
|
|
|
entity.Name = "Updated Test Entity"; |
|
|
|
|
|
|
|
await repository.UpdateAsync(entity); |
|
|
|
await uow.CompleteAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
DateTime? lastModificationTime; |
|
|
|
using (var uow = _unitOfWorkManager.Begin()) |
|
|
|
{ |
|
|
|
var entity = await repository.GetAsync(entityId); |
|
|
|
lastModificationTime = entity.LastModificationTime; |
|
|
|
lastModificationTime.ShouldNotBeNull(); |
|
|
|
await uow.CompleteAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
await Task.Delay(10); |
|
|
|
|
|
|
|
using (var uow = _unitOfWorkManager.Begin()) |
|
|
|
{ |
|
|
|
var entity = await repository.GetAsync(entityId); |
|
|
|
entity.DisabledContactInformation.Street = "Updated Disabled Street"; |
|
|
|
|
|
|
|
await repository.UpdateAsync(entity); |
|
|
|
await uow.CompleteAsync(); |
|
|
|
} |
|
|
|
|
|
|
|
using (var uow = _unitOfWorkManager.Begin()) |
|
|
|
{ |
|
|
|
var entity = await repository.GetAsync(entityId); |
|
|
|
entity.LastModificationTime.ShouldBe(lastModificationTime); |
|
|
|
await uow.CompleteAsync(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class Auditing_DisableLogActionInfo_Tests : Auditing_Tests |
|
|
|
|