mirror of https://github.com/abpframework/abp
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.
27 lines
710 B
27 lines
710 B
using System;
|
|
using Volo.CmsKit.EntityFrameworkCore;
|
|
|
|
namespace Volo.CmsKit;
|
|
|
|
/* Inherit from this class for your domain layer tests.
|
|
* See SampleManager_Tests for example.
|
|
*/
|
|
public abstract class CmsKitDomainTestBase : CmsKitTestBase<CmsKitDomainTestModule>
|
|
{
|
|
protected virtual void UsingDbContext(Action<ICmsKitDbContext> action)
|
|
{
|
|
using (var dbContext = GetRequiredService<ICmsKitDbContext>())
|
|
{
|
|
action.Invoke(dbContext);
|
|
}
|
|
}
|
|
|
|
protected virtual T UsingDbContext<T>(Func<ICmsKitDbContext, T> action)
|
|
{
|
|
using (var dbContext = GetRequiredService<ICmsKitDbContext>())
|
|
{
|
|
return action.Invoke(dbContext);
|
|
}
|
|
}
|
|
}
|