mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
fix(core-tests): 清理 LogContextTests 异步等待 warning
- 修复异步测试中的 await 链 MA0004 warning - 保持 LogContext 在线程隔离场景下的断言行为不变
This commit is contained in:
parent
1b85b53292
commit
a7fa70e4fe
@ -157,7 +157,7 @@ public class LogContextTests
|
||||
using (LogContext.Push("TaskId", "Task1"))
|
||||
{
|
||||
task1Values.Add(LogContext.Current["TaskId"]);
|
||||
await Task.Delay(50);
|
||||
await Task.Delay(50).ConfigureAwait(false);
|
||||
task1Values.Add(LogContext.Current["TaskId"]);
|
||||
}
|
||||
});
|
||||
@ -167,12 +167,12 @@ public class LogContextTests
|
||||
using (LogContext.Push("TaskId", "Task2"))
|
||||
{
|
||||
task2Values.Add(LogContext.Current["TaskId"]);
|
||||
await Task.Delay(50);
|
||||
await Task.Delay(50).ConfigureAwait(false);
|
||||
task2Values.Add(LogContext.Current["TaskId"]);
|
||||
}
|
||||
});
|
||||
|
||||
await Task.WhenAll(task1, task2);
|
||||
await Task.WhenAll(task1, task2).ConfigureAwait(false);
|
||||
|
||||
Assert.That(task1Values, Has.All.EqualTo("Task1"));
|
||||
Assert.That(task2Values, Has.All.EqualTo("Task2"));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user