Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I saw this library the other day, and thought it would be useful for unit testing, but ran into some issues.
I've added a commit with some new tests that should demonstrate the issues.
It seems that whenever the
Assert
class (fromMicrosoft.VisualStudio.TestTools.UnitTesting
) is used within a PoseContext.Isolate entry point, aInvalidProgramException
is thrown with the messageCommon Language Runtime detected an invalid program.
I'm not sure why that is, but I tried with another assertion library, Shouldly, and this time the assertions work, but the problem is that any exceptions from failed assertions (any exceptions actually), are wrapped in a
TargetInvocationException
. This means that the failed unit tests have error messages that are not as useful as they could be.I've added another commit that simply catches that exception and rethrows the inner exception, which solves that particular issue, but I don't know if that is ideal. I'm not very familiar with the project and don't know if the original exception is needed or useful.
Perhaps the best way to deal with this would be to do all asserting outside of the Isolate method.