-
-
Notifications
You must be signed in to change notification settings - Fork 226
Fix Cabinet.Tests when run with xunit.console #484
Conversation
@AArnott I expect to get some pushbash on this change, but can't immediately come up with a better alternative. Other than historical reasons, is there a specific motivation for this project not to use |
I really like using
As for testing, there's no reason I know of that we couldn't use
Quite right. :) Can you please use |
Using |
Unfortunately, IIRC that's because the xunit runner uses shadow copies. |
OK, so we have two other options:
I've used both approaches in various repos. |
I pushed option 1 to your branch. But the test still fails with:
Is this because (I suggest in disbelief) the Cabinet APIs always extract the file to the process's current directory? There doesn't appear to be any parameter taken by |
@AArnott Hah, I had this (based on the xunit documentation):
Yours seems a bit more straightforward, so let's go with that. |
(Alternatively, you can also rewrite |
PS - |
Ooh! I like that idea. I'll give it a shot. |
Turn off shadow copy for Cabinet.Tests so the test assembly is always next to the CAB file that is to be opened.
My debugger isn't working well so I am not going to replace with memory stream right now. But I do think we have a stable test now. |
Environment.CurrentDirectory
is not reliable when running withinxunit.console
- I've seen it being set to the output directory of other tests projects. This adds a manual workaround for that when detecting xunit.