Reputation: 20050
I am trying to write a unit test (NUnit) that will:
I cannot seem to get the logic for this... The test always passes.
Can this be done ?
Upvotes: 0
Views: 537
Reputation: 941337
It is hard to make your unit test fail. The CLR already makes sure that an assembly only gets loaded once. Pretty important, getting the same assembly loaded more than once produces very hard to diagnose casting errors at runtime.
You'd have to use the horrid Assembly.LoadFile() to trip a fail. Avoid testing things you should never do to begin with.
Upvotes: 8
Reputation: 40345
Once you load an assembly in the AppDomain, you cannot load it again and there doesn't appear to be an Assembly.Unload method either. Well, technically you can unload the assembly if you unload all of the AppDomains that loaded it.
Upvotes: 1