mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-13 06:04:30 +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]
|
[Test]
|
||||||
public async Task DestroyAsync_Should_Not_Throw_Exception()
|
public async Task DestroyAsync_Should_Not_Throw_Exception()
|
||||||
{
|
{
|
||||||
Assert.That(async () => await _stateMachine!.DestroyAsync(), Throws.Nothing);
|
Assert.That(() => _stateMachine!.DestroyAsync(), Throws.Nothing);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -216,7 +216,7 @@ public class StateMachineTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void ChangeToAsync_ToUnregisteredState_Should_ThrowInvalidOperationException()
|
public void ChangeToAsync_ToUnregisteredState_Should_ThrowInvalidOperationException()
|
||||||
{
|
{
|
||||||
Assert.ThrowsAsync<InvalidOperationException>(async () => await _stateMachine.ChangeToAsync<TestStateV2>());
|
Assert.ThrowsAsync<InvalidOperationException>(() => _stateMachine.ChangeToAsync<TestStateV2>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -601,4 +601,4 @@ public static class StateMachineExtensions
|
|||||||
.GetValue(stateMachine) is Dictionary<Type, IState> states &&
|
.GetValue(stateMachine) is Dictionary<Type, IState> states &&
|
||||||
states.ContainsKey(typeof(T));
|
states.ContainsKey(typeof(T));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user