I am trying to set up unit tests for a C# project and I think I'm confused about how the directory structure of my test project is set up
In VS2017, I the project expands as follows
Solution
|--*project to test*
| |--*project content*
|
+--*test project*
|--Files
| |--TestDestination
| |--TestDir
| +--EmptyDir
|
|--Controllers
|--Services
+--Models
I have some pre-configured test directories and files in the 'Files' directory that I would like to access from my test classes, but I cannot figure out for the life of me how to express the path to that directory programmatically.
I have tried
Path.Combine("Files", "FileManager", "TestDir")
Which (I think) would navigate to the TestDir directory relative to the project in Java, but I guess C# does not share this convention. I also tried:
Path.Combine(Directory.GetCurrentDirectory(), "Files", "FileManager" "TestDir")
And
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files", "FileManager", "TestDir");
Both of which navigate to the following directory
'C:\Users\John\Source\Repos\*Solution*\Unit_Tests\bin\Debug\netcoreapp2.0\Files\FileManager\TestDir
Which (obviously) is not correct.
Is there a good way to access my project directory programmatically? Or would it be better to get it this way and navigate out of it? If so, how could I do that?