Replies: 2 comments 3 replies
-
|
I second this issue, considering moving FastCloner to TUnit, but we need to run some tests with unsafe context. As an interim solution I'm considering throwing instead of asserting, which is not ideal, but at least it's not sync over async (see above). |
Beta Was this translation helpful? Give feedback.
-
|
Sorry I thought I'd replied to this. Ultimately this is a limitation in TUnits assertion library because it relies on awaiting. The only workaround really is the sync-over-async that you've suggested. You can use TUnit with other assertions libraries, so maybe switching to a sync friendly assertion library makes more sense here |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm taking a test code base that's currently targeting NUnit and moving it to TUnit. I have a test that exists within an unsafe context, and I'm running into an issue with asynchronous assertions. When I call this in my test (note that the containing class is marked as
unsafeand it has to beunsafefor my testing scenario):I'm getting this error:
More details can be found here: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/unsafe-code-errors?f1url=%3FappId%3Droslyn%26k%3Dk(CS4004)#unsafe-context-restrictions.
If I try to remove the
awaitlike this (not ideal):I get this diagnostics:
I can disable the diagnostic:
Is that the only way to get around this?
Beta Was this translation helpful? Give feedback.
All reactions