|
@@ -0,0 +1,43 @@
|
|
|
+using Hotline.Api.Controllers;
|
|
|
+using Hotline.Application.Snapshot;
|
|
|
+using Hotline.Identity.Accounts;
|
|
|
+using Hotline.Identity.Roles;
|
|
|
+using Hotline.Share.Dtos.Snapshot;
|
|
|
+using Hotline.Snapshot.Interfaces;
|
|
|
+using Hotline.Users;
|
|
|
+using Microsoft.AspNetCore.Http;
|
|
|
+using Microsoft.Extensions.DependencyInjection;
|
|
|
+using Shouldly;
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using XF.Domain.Repository;
|
|
|
+
|
|
|
+namespace Hotline.Application.Tests.Application;
|
|
|
+public class InviteCodeApplicationTest : TestBase
|
|
|
+{
|
|
|
+ private readonly IInviteCodeApplication _inviteCodeApplication;
|
|
|
+
|
|
|
+ public InviteCodeApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, IThirdIdentiyService thirdIdentiyService, IThirdAccountRepository thirdAccountRepository, IInviteCodeApplication inviteCodeApplication) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdIdentiyService, thirdAccountRepository)
|
|
|
+ {
|
|
|
+ _inviteCodeApplication = inviteCodeApplication;
|
|
|
+ }
|
|
|
+
|
|
|
+ [Fact]
|
|
|
+ public async Task InviteCode_Test()
|
|
|
+ {
|
|
|
+ var inDto = new AddInviteCodeInDto
|
|
|
+ {
|
|
|
+ OrgName = "测试部门",
|
|
|
+ BeginCode = 1000,
|
|
|
+ EndCode = 2000,
|
|
|
+ };
|
|
|
+
|
|
|
+ await _inviteCodeApplication.AddInviteCodeAsync(inDto);
|
|
|
+
|
|
|
+ var items = _inviteCodeApplication.GetInviteCodeItemsAsync().ToList();
|
|
|
+ items.Count.ShouldNotBe(0);
|
|
|
+ }
|
|
|
+}
|