c# - How to reference a file inside my Test project to load w/o hard coded the path? -
in nunit test project have layout like:
/fixters/somefile.txt /services/someservice.cs
somefile.txt file need read contains text use unit tests.
how can reference folder without hard coding path other team members may store project @ different path me.
if file.readalltext(filepath)
, other equivalent method pass in relative path, runtime use app's current working directory create whole path. speaking, should fine using relative paths. might need specify somefile.txt
gets copied output directory.
if unsure cwd is, try directory.getcurrentdirectory()
Comments
Post a Comment