C
C#2mo ago
VoidPointer

Stuck between using a MetadataLoadContext for reflection and using an assembly reference for testing

Following some advice here, and because it seems sensible, I switched to using a MetadataLoadContext to reflect types from a 3rd party compiled assembly, but now when it comes to testing a method that returns a Type, the most reliable way I have found so far of getting a reliable *expected * Type is to reference the assembly in my test project and use typeof. This means my expected Type comes from an assembly located in the build output, while my actual Type comes from the original location of the assembly of interest. So an assert.Equal on the two types fails. Right now I'm getting by with an assert.Equal on the type names, but that's flimsy.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server