From 6b812ab95cfb1d11e0cf3c44a033921709b13512 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Tue, 27 Jun 2023 13:40:43 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=95=E5=85=83=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
EI_TestProject/EI_APITest.cs | 60 +++++++++++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)
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);
}