|
|
|
@ -39,6 +39,24 @@ namespace Volo.Abp.TestApp.Testing |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Cancel_Deletion_For_Soft_Delete_Entities_ById() |
|
|
|
{ |
|
|
|
var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); |
|
|
|
await PersonRepository.DeleteAsync(douglas.Id); |
|
|
|
|
|
|
|
douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); |
|
|
|
douglas.ShouldBeNull(); |
|
|
|
|
|
|
|
using (DataFilter.Disable<ISoftDelete>()) |
|
|
|
{ |
|
|
|
douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); |
|
|
|
douglas.ShouldNotBeNull(); |
|
|
|
douglas.IsDeleted.ShouldBeTrue(); |
|
|
|
douglas.DeletionTime.ShouldNotBeNull(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Handle_Deletion_On_Update_For_Soft_Delete_Entities() |
|
|
|
{ |
|
|
|
@ -82,5 +100,27 @@ namespace Volo.Abp.TestApp.Testing |
|
|
|
douglas.Phones.ShouldNotBeEmpty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Cascading_Entities_Should_Not_Be_Deleted_When_Soft_Deleting_Entities_ById() |
|
|
|
{ |
|
|
|
var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); |
|
|
|
douglas.Phones.ShouldNotBeEmpty(); |
|
|
|
|
|
|
|
await PersonRepository.DeleteAsync(douglas.Id); |
|
|
|
|
|
|
|
douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); |
|
|
|
douglas.ShouldBeNull(); |
|
|
|
|
|
|
|
using (DataFilter.Disable<ISoftDelete>()) |
|
|
|
{ |
|
|
|
douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); |
|
|
|
douglas.ShouldNotBeNull(); |
|
|
|
douglas.IsDeleted.ShouldBeTrue(); |
|
|
|
douglas.DeletionTime.ShouldNotBeNull(); |
|
|
|
|
|
|
|
douglas.Phones.ShouldNotBeEmpty(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|