diff --git a/EI_TestProject/EI_APITest.cs b/EI_TestProject/EI_APITest.cs index c7a263ea..5806c9a5 100644 --- a/EI_TestProject/EI_APITest.cs +++ b/EI_TestProject/EI_APITest.cs @@ -2,6 +2,7 @@ using System.Net; using System.Text; using System.Text.Json.Nodes; using Azure.Core; +using BeetleX.Redis.Commands; using EI_TestProject; using IRaCIS.Application.Contracts; using IRaCIS.Core.Infrastructure; @@ -28,20 +29,77 @@ public class UserApiTests : IDisposable } + /// + /// 添加系统用户 + /// + [Fact] + public async void Test_AddUser() + { + + var url = $"/user/addUser"; + + var jsonBody = new JObject + { + { "UserName", "test_hang" }, + { "LastName", "zhou" }, + { "FirstName", "hang" }, + { "Sex", 1 }, + { "EMail", "872297557@qq.com" }, + { "Phone", "" }, + { "UserTypeId", "40240000-3e2c-0016-b35f-08db1895d627" }, + { "IsZhiZhun", "" }, + { "OrganizationName", "" }, + { "DepartmentName", "" }, + { "PositionName", "" }, + { "IsTestUser", true }, + { "UserTypeEnum", 1 }, + { "BaseUrl", "http://123.56.94.154:8090/login" }, + { "RouteUrl", "http://123.56.94.154:8090/email-recompose" }, + { "RealName", string.Empty } + }; + var result = await RestHelper.Post_JsonBodyRequestAsync>(url,jsonBody); + + Assert.True(result.Code == ApiResponseCodeEnum.ApiInputError && result.Code != ApiResponseCodeEnum.ProgramException); + } + + + /// + /// 查询系统用户 + /// + [Fact] + public async void Test_GetUserList() + { + var url = $"/user/getUserList"; + + var jsonBody = new JObject + { + { "RealName", string.Empty } + }; + + //测试删除Api + var result = await RestHelper.Post_JsonBodyRequestAsync>>(url, jsonBody); + + Assert.True(result.Data.CurrentPageData.Count >= 0); + } + + /// /// 删除系统用户 /// [Fact] - public async void Test_DeleteUserById() + public async void Test_DeleteUser() { var userId = Guid.Parse("98430000-3e2c-0016-225f-08db7612c7ae"); var url = $"/user/deleteUser/{userId}"; + //测试删除Api var result = await RestHelper.DeleteRequestAsync>(url); + + Assert.True(result.Code==ApiResponseCodeEnum.ApiInputError && result.Code != ApiResponseCodeEnum.ProgramException); }