public async Task Should_Trigger_Middleware_And_AuditLog_Success_For_GetRequests() { _options.IsEnabledForGetRequests = true; _options.AlwaysLogOnException = false; await GetResponseAsync("api/audit-test/audit-success"); await _auditingStore.Received().SaveAsync(Arg.Any <AuditLogInfo>()); }
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)))); }
public async Task Should_Write_AuditLog_For_Classes_That_Implement_IAuditingEnabled() { var myAuditedObject1 = GetRequiredService <MyAuditedObject1>(); using (var scope = _auditingManager.BeginScope()) { await myAuditedObject1.DoItAsync(new InputObject { Value1 = "forty-two", Value2 = 42 }); await scope.SaveAsync(); } #pragma warning disable 4014 _auditingStore.Received().SaveAsync(Arg.Any <AuditLogInfo>()); #pragma warning restore 4014 }
public async Task RazorPage_RazorAuditPageFilter_Get_Test(string pageName, bool shouldWriteAuditLog) { // Arrange var client = _factory.CreateClient(); // Act var response = await client.GetAsync("/" + pageName); // Assert response.EnsureSuccessStatusCode(); #pragma warning disable 4014 if (shouldWriteAuditLog) { _auditingStore.Received().SaveAsync(Arg.Is <AuditInfo>(a => a.ServiceName.Contains(pageName))); } else { _auditingStore.DidNotReceive().SaveAsync(Arg.Any <AuditInfo>()); } #pragma warning restore 4014 }
public async Task Should_Trigger_Middleware_And_AuditLog_Success_For_GetRequests() { await GetResponseAsync("api/audit-test/audit-success"); await _auditingStore.Received().SaveAsync(Arg.Any <AuditInfo>()); }
public async Task Should_Trigger_Middleware_And_AuditLog_Success_For_GetRequests() { await GetResponseAsync("/Auditing/AuditTestPage?handler=AuditSuccessForGetRequests"); await _auditingStore.Received().SaveAsync(Arg.Any <AuditInfo>()); }