You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone!
I use NUnit V3.4.1 in a WPF Solution, vs2015, window7-32bit.
When I call Directory.GetCurrentDirectory() in a TestMethod, it return @"C:\Windows"\system32 instead of the TestAssembly's value.
Is it the way NUnit design to be?
Follow are screenshot and code.
The text was updated successfully, but these errors were encountered:
This is covered in the Breaking Changes page of the docs. It's a decision we made when we created NUnit 3.0.
NUnit V2 had a guarantee that the current directory would be the directory that contains your test assembly. In order to guarantee this, we had to change the current directory each time a new assembly was loaded or run. We decided that this was a bad idea, for several reasons:
In general, if you start a program with a certain CD, it really should not be changing it.
It becomes particularly problematic with the introduction of parallel execution.
As explained in the docs, if you need to find out the directory in which the assembly resides, you can use TestContext.CurrentContext.TestDirectory.
Note that if you are using the directory for output, you should use WorkDirectory rather than TestDirectory. WorkDirectory usually is the same as TestDirectory but can be changed from the command-line.
Hello everyone!
I use NUnit V3.4.1 in a WPF Solution, vs2015, window7-32bit.
When I call Directory.GetCurrentDirectory() in a TestMethod, it return @"C:\Windows"\system32 instead of the TestAssembly's value.
Is it the way NUnit design to be?
Follow are screenshot and code.
The text was updated successfully, but these errors were encountered: