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.
62 lines
1.8 KiB
62 lines
1.8 KiB
using System.Threading.Tasks;
|
|
using Shouldly;
|
|
using Volo.Abp.Modularity;
|
|
using Xunit;
|
|
|
|
namespace Volo.CmsKit.Pages
|
|
{
|
|
public abstract class PageRepository_Test<TStartupModule> : CmsKitTestBase<TStartupModule>
|
|
where TStartupModule : IAbpModule
|
|
{
|
|
private readonly CmsKitTestData _cmsKitTestData;
|
|
private readonly IPageRepository _pageRepository;
|
|
|
|
protected PageRepository_Test()
|
|
{
|
|
_cmsKitTestData = GetRequiredService<CmsKitTestData>();
|
|
_pageRepository = GetRequiredService<IPageRepository>();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ShouldGetByUrlAsync()
|
|
{
|
|
var page = await _pageRepository.GetByUrlAsync(_cmsKitTestData.Page_1_Url);
|
|
|
|
page.ShouldNotBeNull();
|
|
page.Description.ShouldBe(_cmsKitTestData.Page_1_Description);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ShouldFindByUrlAsync()
|
|
{
|
|
var page = await _pageRepository.FindByUrlAsync(_cmsKitTestData.Page_1_Url);
|
|
|
|
page.ShouldNotBeNull();
|
|
page.Description.ShouldBe(_cmsKitTestData.Page_1_Description);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ShouldNotFindByUrlAsync()
|
|
{
|
|
var page = await _pageRepository.FindByUrlAsync("not-exist-lyrics");
|
|
|
|
page.ShouldBeNull();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ShouldBeExistAsync()
|
|
{
|
|
var page = await _pageRepository.DoesExistAsync(_cmsKitTestData.Page_1_Url);
|
|
|
|
page.ShouldBeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task ShouldNotBeExistAsync()
|
|
{
|
|
var page = await _pageRepository.DoesExistAsync("not-exist-lyrics");
|
|
|
|
page.ShouldBeFalse();
|
|
}
|
|
}
|
|
} |