Replies: 2 comments 3 replies
-
|
One of the main reasons for this is that the Consider this:
If assertions executed immediately, without the await keyword, this may fail and throw immediately on the Sure, I could have opted for an I can't really think of a way around this with the current state of the language. I think your options are:
|
Beta Was this translation helpful? Give feedback.
-
|
This isn't about chaining assertion calls, it's about valid C# coding scenarios. In the unsafe example, this code now fails: var pValue = &value;This isn't even in an assertion, but because the whole test now needs to be With a await Assert.That(data[0]).IsEqualTo(1);That isn't chaining, just a simple equality check. But because I have to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Overall, I like TUnit, but one area I'm finding problematic is with its insistence that everything must be asynchronous. This is starting to become kind of a PITA in certain scenarios:
async, you start to run into issues like CS4004 and CS9123.Span<>usage. If I have aSpan<>in a test, and I want to read values from thatSpan<>withinAssert.That(), I can't, because I'll getCS4007. I can get around this by capturing all the values before I start doing assertions, but this is kind of clumsy and unnecessary.While unsafe code isn't common, it is valid. Furthermore,
Span<>types are showing up more often, and eliminating theasyncboundary would make tests easier to write. I feel like there should be some consideration to having synchronous assertions. Curious to hear what others have to say.Beta Was this translation helpful? Give feedback.
All reactions