mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
test(core-tests): 简化结果与协程异步断言包装
- 简化 ResultExtensionsTests 中的异步异常断言包装 - 更新 AsyncOperationTests 的 Task 断言写法以消除低风险 analyzer 噪音
This commit is contained in:
parent
ffd62bb475
commit
65cd23ff3e
@ -104,7 +104,7 @@ public class AsyncOperationTests
|
|||||||
|
|
||||||
op.SetException(expectedException);
|
op.SetException(expectedException);
|
||||||
|
|
||||||
Assert.That(async () => await op.Task, Throws.InstanceOf<InvalidOperationException>());
|
Assert.That(() => op.Task, Throws.InstanceOf<InvalidOperationException>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -339,4 +339,4 @@ public class AsyncOperationTests
|
|||||||
|
|
||||||
Assert.DoesNotThrow(() => op.SetCompleted());
|
Assert.DoesNotThrow(() => op.SetCompleted());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -487,7 +487,7 @@ public class ResultExtensionsTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void TryAsync_Should_Throw_ArgumentNullException_When_Function_Is_Null()
|
public void TryAsync_Should_Throw_ArgumentNullException_When_Function_Is_Null()
|
||||||
{
|
{
|
||||||
Assert.ThrowsAsync<ArgumentNullException>(async () => await ResultExtensions.TryAsync<int>(null!));
|
Assert.ThrowsAsync<ArgumentNullException>(() => ResultExtensions.TryAsync<int>(null!));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user