Closed karpikpl closed 2 years ago
The above is an abuse of the intended expressions capabilities of UnitTestEx
. The expressions enable additional logging and features behind the scenes as the function is not immediately executed. For example, in the above, the expression will be automatically converted into an HttpRequest
versus calling the expression function directly - it is intended to make using and invoking the test easier (more logical).
UnitTestEx
has been updated to throw an InvalidOperationException
where the likes of method-chaining are used to invoke. Otherwise, the underlying intended behavior remains unchanged.
@karpikpl, are there other scenarios you have encountered that need to be accounted for here?
Hey @chullybun I've pushed a branch to show some issues I see with using expressions in UnitTestEx
https://github.com/Avanade/UnitTestEx/blob/77c70fdbcfafeef721fda496b9be44f732f68c1d/tests/UnitTestEx.MSTest.Test/ExpressionTest.cs#L19-L28