NUnit test doesn't run in BIN folder

Answered

Hello!

Resharper 2017.1.2 Ultimate. Trying to run Unit Test from BIN directory. I removed "Shadow-copy assemblies being tested" and "Enable NUnit 2.x support". NUnit Test are still ran from: 

C:\Users\<USR>\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_846a7eb6_000\DataFiles\

What to try next?

4 comments
Comment actions Permalink

I am also facing this issue. Being able to tell Resharper again which folder to use to execute the tests would be much appreciated.

 

The issue seems to occur when a referenced DLL loads another assembly via reflection (which is then not copied correctly to the C:\Users\<user>\AppData\Local\JetBrains\Installations\ReSharperPlatformVs14 folder).

 

An example of how to produce the issue can be found here.

 

3
Comment actions Permalink

Hi!

Support referenced me to the problem: https://github.com/nunit/nunit/issues/1072 and https://github.com/nunit/nunit/issues/742 

Here is the solution. Hope it will work for you! 

[OneTimeSetUp]
public void RunBeforeAnyTests()
{
var dir = Path.GetDirectoryName(typeof(TestingWithReferencedFiles).Assembly.Location);
if (dir != null)
{
Environment.CurrentDirectory = dir;
Directory.SetCurrentDirectory(dir);
}
else
throw new Exception("Path.GetDirectoryName(typeof(TestingWithReferencedFiles).Assembly.Location) returned null");
}

2
Comment actions Permalink

Solves it for me, thx.

1
Comment actions Permalink

No problem, glad to help! :)

 

1

Please sign in to leave a comment.