mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-03 00:00:58 +08:00
feat: 简化测试
This commit is contained in:
@@ -8,6 +8,14 @@ namespace Yi.Framework.Bbs.Application.Contracts.IServices
|
||||
/// </summary>
|
||||
public interface ICommentService : IYiCrudAppService<CommentGetOutputDto, CommentGetListOutputDto, Guid, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 发表评论
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UserFriendlyException"></exception>
|
||||
// [Permission("bbs:comment:add")]
|
||||
// [Authorize]
|
||||
Task<CommentGetOutputDto> CreateAsync(CommentCreateInputVo input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Settings;
|
||||
using Volo.Abp.Uow;
|
||||
using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner;
|
||||
using Yi.Framework.Bbs.Application.Contracts.Dtos.Comment;
|
||||
using Yi.Framework.Bbs.Application.Contracts.IServices;
|
||||
using Yi.Framework.Bbs.Domain.Entities.Forum;
|
||||
using Yi.Framework.Rbac.Domain.Authorization;
|
||||
using Yi.Framework.Rbac.Domain.Extensions;
|
||||
@@ -25,6 +27,24 @@ namespace Yi.Abp.Application.Services
|
||||
/// </summary>
|
||||
public ISqlSugarRepository<BannerAggregateRoot> sqlSugarRepository { get; set; }
|
||||
|
||||
private ICommentService _commentService;
|
||||
public readonly ISqlSugarRepository<CommentAggregateRoot, Guid> _commentRepository;
|
||||
public TestService(ICommentService commentService, ISqlSugarRepository<CommentAggregateRoot, Guid> commentRepository)
|
||||
{
|
||||
_commentService = commentService;
|
||||
_commentRepository = commentRepository;
|
||||
}
|
||||
|
||||
public async Task<string> GetAbpUnitOfWorkMiddleware()
|
||||
{
|
||||
var entity = new CommentAggregateRoot(Guid.Empty);
|
||||
entity.Content = "测试";
|
||||
entity.ParentId = Guid.Empty;
|
||||
entity.RootId = Guid.Empty;
|
||||
await _commentRepository.InsertAsync(entity);
|
||||
return "yes";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 动态Api
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user