XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.ServerInteractive

[DLL] Server interaction extension, including user identity verification and querying in conjunction with AutoConfig

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.ServerInteractive

修改部分测试用例

9874cee
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

2 个文件 +40 -18
Modified XFEExtension.NetCore.ServerInteractive.TServer/Program.cs +3 -0
@@ -33,6 +33,9 @@ var server = XFEServerBuilder.CreateBuilder() // 创建服务器构建器
33 33 .AddService<TimeCoreService>()
34 34 .Build(options =>
35 35 {
36 options.AcceptGet = true;
37 options.AcceptPost = true;
38 options.AcceptNonStandardJson = true;
36 39 options.MainEntryPoint = "api";
37 40 options.BindIP("http://localhost:3305/")
38 41 .BindIP("https://localhost:3306/");
Modified XFEExtension.NetCore.ServerInteractive.Test/Program.cs +37 -18
@@ -63,10 +63,29 @@ internal class Program
63 63
64 64 #region 基础测试
65 65
66 [SMTest]
67 public static async Task TestGET()
68 {
69 var client = new HttpClient
70 {
71 BaseAddress = new Uri("http://localhost:3305/api/")
72 };
73 var response = await client.GetAsync("test");
74 if (response.IsSuccessStatusCode)
75 {
76 var content = await response.Content.ReadAsStringAsync();
77 Console.WriteLine(content);
78 }
79 else
80 {
81 Console.WriteLine($"请求失败:{response.StatusCode}");
82 }
83 }
84
66 85 /// <summary>
67 86 /// 测试基本的test端点请求
68 87 /// </summary>
69 [SMTest]
88 //[SMTest]
70 89 public static async Task Test()
71 90 {
72 91 var result = await s_xFEClientRequester.Request<string>("test");
@@ -84,7 +103,7 @@ internal class Program
84 103 /// <summary>
85 104 /// 测试连接检查端点
86 105 /// </summary>
87 [SMTest]
106 //[SMTest]
88 107 public static async Task Check()
89 108 {
90 109 try
@@ -113,7 +132,7 @@ internal class Program
113 132 /// <summary>
114 133 /// 测试用户登录功能
115 134 /// </summary>
116 [SMTest("Admin", "123456")]
135 //[SMTest("Admin", "123456")]
117 136 public static async Task Login(string account, string password)
118 137 {
119 138 var result = await s_xFEClientRequester.Request<UserLoginResult<UserFaceInfo>>("login", account, password);
@@ -138,7 +157,7 @@ internal class Program
138 157 /// <summary>
139 158 /// 测试无效用户登录(错误密码)
140 159 /// </summary>
141 [SMTest("Admin", "wrong_password")]
160 //[SMTest("Admin", "wrong_password")]
142 161 public static async Task LoginWithWrongPassword(string account, string password)
143 162 {
144 163 var result = await s_xFEClientRequester.Request<UserLoginResult<UserFaceInfo>>("login", account, password);
@@ -149,7 +168,7 @@ internal class Program
149 168 /// <summary>
150 169 /// 测试无效用户登录(不存在的用户)
151 170 /// </summary>
152 [SMTest("NonExistentUser", "123456")]
171 //[SMTest("NonExistentUser", "123456")]
153 172 public static async Task LoginWithNonExistentUser(string account, string password)
154 173 {
155 174 var result = await s_xFEClientRequester.Request<UserLoginResult<UserFaceInfo>>("login", account, password);
@@ -184,7 +203,7 @@ internal class Program
184 203 /// <summary>
185 204 /// 测试Echo服务:发送消息并验证原样返回
186 205 /// </summary>
187 [SMTest]
206 //[SMTest]
188 207 public static async Task EchoTest()
189 208 {
190 209 var result = await s_xFEClientRequester.Request<string>("echo", "Hello, XFE!");
@@ -201,7 +220,7 @@ internal class Program
201 220 /// <summary>
202 221 /// 测试Echo服务:发送空消息
203 222 /// </summary>
204 [SMTest]
223 //[SMTest]
205 224 public static async Task EchoEmptyTest()
206 225 {
207 226 var result = await s_xFEClientRequester.Request<string>("echo", string.Empty);
@@ -218,7 +237,7 @@ internal class Program
218 237 /// <summary>
219 238 /// 测试Echo服务:发送中文消息
220 239 /// </summary>
221 [SMTest]
240 //[SMTest]
222 241 public static async Task EchoChineseTest()
223 242 {
224 243 var result = await s_xFEClientRequester.Request<string>("echo", "你好,世界!");
@@ -239,7 +258,7 @@ internal class Program
239 258 /// <summary>
240 259 /// 测试加法运算
241 260 /// </summary>
242 [SMTest]
261 //[SMTest]
243 262 public static async Task MathAddTest()
244 263 {
245 264 var result = await s_xFEClientRequester.Request<string>("math/add", 3.0, 5.0);
@@ -256,7 +275,7 @@ internal class Program
256 275 /// <summary>
257 276 /// 测试乘法运算
258 277 /// </summary>
259 [SMTest]
278 //[SMTest]
260 279 public static async Task MathMultiplyTest()
261 280 {
262 281 var result = await s_xFEClientRequester.Request<string>("math/multiply", 4.0, 7.0);
@@ -273,7 +292,7 @@ internal class Program
273 292 /// <summary>
274 293 /// 测试加法运算:负数
275 294 /// </summary>
276 [SMTest]
295 //[SMTest]
277 296 public static async Task MathAddNegativeTest()
278 297 {
279 298 var result = await s_xFEClientRequester.Request<string>("math/add", -10.0, 3.0);
@@ -290,7 +309,7 @@ internal class Program
290 309 /// <summary>
291 310 /// 测试乘法运算:零
292 311 /// </summary>
293 [SMTest]
312 //[SMTest]
294 313 public static async Task MathMultiplyZeroTest()
295 314 {
296 315 var result = await s_xFEClientRequester.Request<string>("math/multiply", 42.0, 0.0);
@@ -307,7 +326,7 @@ internal class Program
307 326 /// <summary>
308 327 /// 测试加法运算:小数
309 328 /// </summary>
310 [SMTest]
329 //[SMTest]
311 330 public static async Task MathAddDecimalTest()
312 331 {
313 332 var result = await s_xFEClientRequester.Request<string>("math/add", 1.5, 2.3);
@@ -328,7 +347,7 @@ internal class Program
328 347 /// <summary>
329 348 /// 测试服务器状态端点
330 349 /// </summary>
331 [SMTest]
350 //[SMTest]
332 351 public static async Task StatusTest()
333 352 {
334 353 var result = await s_xFEClientRequester.Request<string>("status");
@@ -349,7 +368,7 @@ internal class Program
349 368 /// <summary>
350 369 /// 测试问候服务:正常名称
351 370 /// </summary>
352 [SMTest]
371 //[SMTest]
353 372 public static async Task GreetTest()
354 373 {
355 374 var result = await s_xFEClientRequester.Request<string>("greet", "XFEstudio");
@@ -366,7 +385,7 @@ internal class Program
366 385 /// <summary>
367 386 /// 测试问候服务:空名称(应返回错误)
368 387 /// </summary>
369 [SMTest]
388 //[SMTest]
370 389 public static async Task GreetEmptyNameTest()
371 390 {
372 391 var result = await s_xFEClientRequester.Request<string>("greet");
@@ -463,7 +482,7 @@ internal class Program
463 482 /// <summary>
464 483 /// 测试添加订单
465 484 /// </summary>
466 [SMTest]
485 //[SMTest]
467 486 public static async Task<bool> AddOrder() => await TableRequester.Add<Order>(new()
468 487 {
469 488 Description = "测试订单的描述",
@@ -473,7 +492,7 @@ internal class Program
473 492 /// <summary>
474 493 /// 测试获取订单列表
475 494 /// </summary>
476 [SMTest]
495 //[SMTest]
477 496 public static async Task GetOrder()
478 497 {
479 498 var result = await TableRequester.Get<Order>();