|
@@ -1,11 +1,15 @@
|
|
|
using Hotline.Api.Controllers;
|
|
|
using Hotline.Application.Knowledge;
|
|
|
+using Hotline.Application.Tools;
|
|
|
+using Hotline.File;
|
|
|
using Hotline.Identity.Accounts;
|
|
|
using Hotline.Identity.Roles;
|
|
|
using Hotline.KnowledgeBase;
|
|
|
using Hotline.KnowledgeBase.Notifies;
|
|
|
using Hotline.Settings;
|
|
|
+using Hotline.Share.Dtos.File;
|
|
|
using Hotline.Share.Dtos.Knowledge;
|
|
|
+using Hotline.Share.Enums.Article;
|
|
|
using Hotline.Share.Tools;
|
|
|
using Hotline.ThirdAccountDomainServices;
|
|
|
using Hotline.ThirdAccountDomainServices.Interfaces;
|
|
@@ -14,6 +18,7 @@ using Mapster;
|
|
|
using MediatR;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
+using Senparc.Weixin.WxOpen.AdvancedAPIs.Tcb;
|
|
|
using Shouldly;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -33,8 +38,9 @@ public class KnowApplicationTest : TestBase
|
|
|
private readonly IKnowledgeDomainService _knowledgeDomainService;
|
|
|
private readonly IRepository<KnowledgeWord> _knowledgeWordRepository;
|
|
|
private readonly IRepository<KnowledgeHotWord> _knowledgeHotWordRepository;
|
|
|
+ private readonly IFileDomainService _fileDomainService;
|
|
|
|
|
|
- public KnowApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IKnowApplication knowApplication, IMediator mediator, IRepository<KnowledgeBase.Knowledge> knowledgeRepository, IKnowledgeDomainService knowledgeDomainService, IRepository<KnowledgeWord> knowledgeWordRepository, IRepository<KnowledgeHotWord> knowledgeHotWordRepository, IThirdIdentiyService thirdService, IThirdAccountRepository thirdAccount, ITypedCache<SystemSetting> cacheSettingData, ThirdAccounSupplierFactory thirdAccountDomainFactory) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdService, thirdAccount, cacheSettingData, thirdAccountDomainFactory)
|
|
|
+ public KnowApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IKnowApplication knowApplication, IMediator mediator, IRepository<KnowledgeBase.Knowledge> knowledgeRepository, IKnowledgeDomainService knowledgeDomainService, IRepository<KnowledgeWord> knowledgeWordRepository, IRepository<KnowledgeHotWord> knowledgeHotWordRepository, IThirdIdentiyService thirdService, IThirdAccountRepository thirdAccount, ITypedCache<SystemSetting> cacheSettingData, ThirdAccounSupplierFactory thirdAccountDomainFactory, IFileDomainService fileDomainService) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdService, thirdAccount, cacheSettingData, thirdAccountDomainFactory)
|
|
|
{
|
|
|
_knowApplication = knowApplication;
|
|
|
_mediator = mediator;
|
|
@@ -42,6 +48,7 @@ public class KnowApplicationTest : TestBase
|
|
|
_knowledgeDomainService = knowledgeDomainService;
|
|
|
_knowledgeWordRepository = knowledgeWordRepository;
|
|
|
_knowledgeHotWordRepository = knowledgeHotWordRepository;
|
|
|
+ _fileDomainService = fileDomainService;
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -127,4 +134,12 @@ public class KnowApplicationTest : TestBase
|
|
|
a.IsNullOrEmpty().ShouldBeTrue();
|
|
|
a.NotNullOrEmpty().ShouldBeFalse();
|
|
|
}
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public async Task Word_Upload_Test()
|
|
|
+ {
|
|
|
+
|
|
|
+ var fileJson = await _fileDomainService.UploadFileFromMemoryAsync("<div>123</div>".HtmlToWord(), "测试文件" + EFileType.word.GetFileExtension(), EFileType.word);
|
|
|
+ fileJson.Id.ShouldNotBeNull();
|
|
|
+ }
|
|
|
}
|