开发者

How to copy resource (any content) files to output folder when NUnit's shadow copying is turned on?

开发者 https://www.devze.com 2023-01-03 04:36 出处:网络
Of course there is an option to turn it off (by default it is on.) However I like to be able to make incremental changes to the DLL while a copy of NUnit GUI is up.

Of course there is an option to turn it off (by default it is on.) However I like to be able to make incremental changes to the DLL while a copy of NUnit GUI is up.

However I couldn't find much documentation for this feature (apart from the need) So the problem is like this

With Shadow copy enabled in NUnit,

my SUT (Dll) invokes an executable (also in the output folder ; via references). Now this executable needs certain configuration/modifier files to be in the same folder as the executable. How do I ensure that my reference modifier files are reachable by the executable during the test ?

Does NUnit shadow copy just the SUT dll or all the linked/referenced dlls/execs 开发者_高级运维? What do I need to do in the test setup such that any supporting files for the SUT are copied correctly?

I see that

  • executingAssembly.Codebase gives me the original output folder
  • executingAssembly.Location gives me the shadow copy folder.

I'm not sure if I am being lucid here - let me know if I need to update


The real issue is usually finding where they are during the tests.

Use this instead of Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location):

string exeDirectory = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);

See Trouble with NUnit when determining the assembly's directory

0

精彩评论

暂无评论...
验证码 换一张
取 消