mirror of https://github.com/abpframework/abp.git
5 changed files with 128 additions and 6 deletions
@ -0,0 +1,9 @@ |
|||
using Volo.CmsKit.Pages; |
|||
|
|||
namespace Volo.CmsKit.EntityFrameworkCore.Pages |
|||
{ |
|||
public class PageRepository_Test : PageRepository_Test<CmsKitEntityFrameworkCoreTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using Volo.CmsKit.Pages; |
|||
using Xunit; |
|||
|
|||
namespace Volo.CmsKit.MongoDB.Pages |
|||
{ |
|||
[Collection(MongoTestCollection.Name)] |
|||
public class PageRepository_Test : PageRepository_Test<CmsKitMongoDbTestModule> |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
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(); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue