Posts

Showing posts with the label xunit

How to access C# project directory [duplicate]

This question already has an answer here: 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 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 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: And Both of which navigate to the following directory 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? This question has been asked before and already has an answer. If those answers do not fully address your question, ple...