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.
41 lines
1.3 KiB
41 lines
1.3 KiB
using System.Threading.Tasks;
|
|
using Shouldly;
|
|
using Volo.Abp.Modularity;
|
|
using Xunit;
|
|
|
|
namespace Volo.CmsKit.Ratings;
|
|
|
|
public abstract class RatingRepository_Tests<TStartupModule> : CmsKitTestBase<TStartupModule>
|
|
where TStartupModule : IAbpModule
|
|
{
|
|
private readonly CmsKitTestData _cmsKitTestData;
|
|
private readonly IRatingRepository _ratingRepository;
|
|
|
|
public RatingRepository_Tests()
|
|
{
|
|
_cmsKitTestData = GetRequiredService<CmsKitTestData>();
|
|
_ratingRepository = GetRequiredService<IRatingRepository>();
|
|
}
|
|
|
|
[Fact]
|
|
public async Task GetCurrentUserRatingAsync()
|
|
{
|
|
var userRating = await _ratingRepository.GetCurrentUserRatingAsync(_cmsKitTestData.EntityType1,
|
|
_cmsKitTestData.EntityId1, _cmsKitTestData.User1Id);
|
|
|
|
userRating.ShouldNotBeNull();
|
|
userRating.EntityId.ShouldBe(_cmsKitTestData.EntityId1);
|
|
userRating.EntityType.ShouldBe(_cmsKitTestData.EntityType1);
|
|
userRating.CreatorId.ShouldBe(_cmsKitTestData.User1Id);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task GetGroupedStarCountsAsync()
|
|
{
|
|
var list = await _ratingRepository.GetGroupedStarCountsAsync(_cmsKitTestData.EntityType1,
|
|
_cmsKitTestData.EntityId1);
|
|
|
|
list.ShouldNotBeNull();
|
|
}
|
|
}
|