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/cms-kit/test/Volo.CmsKit.Application.Tests/CmsKitApplicationTestBase.cs

27 lines
728 B

using System;
using Volo.CmsKit.EntityFrameworkCore;
namespace Volo.CmsKit;
/* Inherit from this class for your application layer tests.
* See SampleAppService_Tests for example.
*/
public abstract class CmsKitApplicationTestBase : CmsKitTestBase<CmsKitApplicationTestModule>
{
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);
}
}
}