mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-08 17:44:29 +08:00
refactor(core-tests): 简化状态机异步断言包装
- 简化 StateMachineSystemTests 中的 Task 异常断言包装 - 简化 StateMachineTests 中的异步异常断言包装并保持测试语义不变
This commit is contained in:
parent
67c9359fd2
commit
0d8f854dd2
@ -138,7 +138,7 @@ public class StateMachineSystemTests
|
||||
[Test]
|
||||
public async Task DestroyAsync_Should_Not_Throw_Exception()
|
||||
{
|
||||
Assert.That(async () => await _stateMachine!.DestroyAsync(), Throws.Nothing);
|
||||
Assert.That(() => _stateMachine!.DestroyAsync(), Throws.Nothing);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -216,7 +216,7 @@ public class StateMachineTests
|
||||
[Test]
|
||||
public void ChangeToAsync_ToUnregisteredState_Should_ThrowInvalidOperationException()
|
||||
{
|
||||
Assert.ThrowsAsync<InvalidOperationException>(async () => await _stateMachine.ChangeToAsync<TestStateV2>());
|
||||
Assert.ThrowsAsync<InvalidOperationException>(() => _stateMachine.ChangeToAsync<TestStateV2>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -601,4 +601,4 @@ public static class StateMachineExtensions
|
||||
.GetValue(stateMachine) is Dictionary<Type, IState> states &&
|
||||
states.ContainsKey(typeof(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user