You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/AuditLogsTestBase.cs

33 lines
975 B

using System;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
namespace Volo.Abp.AuditLogging
{
public class AuditLogsTestBase : AuditLoggingTestBase<AbpAuditLoggingTestModule>
{
protected virtual void UsingDbContext(Action<IAuditLoggingDbContext> action)
{
using (var dbContext = GetRequiredService<IAuditLoggingDbContext>())
{
action.Invoke(dbContext);
}
}
protected virtual T UsingDbContext<T>(Func<IAuditLoggingDbContext, T> action)
{
using (var dbContext = GetRequiredService<IAuditLoggingDbContext>())
{
return action.Invoke(dbContext);
}
}
protected List<AuditLog> GetAuditLogsFromDbContext()
{
return UsingDbContext(context =>
context.AuditLogs.IncludeDetails().ToList()
);
}
}
}