Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Environment.CurrentDirectory returns wrong Directory

I have added a NUnit test project to a project in order to make unit test

My main project is in

C:\Users\myName\Desktop\0120-project\ProjectName\

Unit test project is in :

C:\Users\myName\Desktop\0120-project\ProjectNameTest\

Now when I'm debugging a unit test :

[Test]
     public void ExportationTest()
     {
       var evan= System.Environment.CurrentDirectory;
         //...           
     }

the returned value of evan is :

C:\Users\myName\AppData\Local\JetBrains\ReSharperPlatformVs12

how is that even possible?! I'm not even launching the project from there. I'm using visual studio 2013 environement .

like image 862
napi15 Avatar asked Mar 07 '23 09:03

napi15


1 Answers

From the documentation:

Environment.CurrentDirectory Property

Gets or sets the fully qualified path of the current working directory.

It looks like you are using ReSharper to launch your tests, which is probably setting the working directory to that location.

like image 199
JuanR Avatar answered Mar 25 '23 01:03

JuanR