|
|
|
@ -1,4 +1,5 @@ |
|
|
|
using System.Threading.Tasks; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions; |
|
|
|
using Microsoft.Extensions.Hosting; |
|
|
|
@ -27,6 +28,17 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing |
|
|
|
base.ConfigureServices(context, services); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Get_Correct_ServiceName_And_MethodName() |
|
|
|
{ |
|
|
|
_options.IsEnabledForGetRequests = true; |
|
|
|
_options.AlwaysLogOnException = false; |
|
|
|
await GetResponseAsync("/Auditing/AuditTestPage"); |
|
|
|
await _auditingStore.Received().SaveAsync(Arg.Is<AuditLogInfo>(x => |
|
|
|
x.Actions.Any(a => a.ServiceName == typeof(AuditTestPage).FullName) && |
|
|
|
x.Actions.Any(a => a.MethodName == nameof(AuditTestPage.OnGet)))); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Trigger_Middleware_And_AuditLog_Success_For_GetRequests() |
|
|
|
{ |
|
|
|
@ -50,7 +62,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing |
|
|
|
|
|
|
|
await _auditingStore.Received().SaveAsync(Arg.Any<AuditLogInfo>()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task Should_Trigger_Middleware_And_AuditLog_Exception_When_Returns_Object() |
|
|
|
{ |
|
|
|
@ -62,4 +74,4 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing |
|
|
|
await _auditingStore.Received().SaveAsync(Arg.Any<AuditLogInfo>()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|