M
M
Morrowind2021-12-09 19:39:36
C++ / C#
Morrowind, 2021-12-09 19:39:36

How to change default path in Nunit test?

Hello.
Nuyuans in the following:
There is a method which eats string of a file name of a certain project.

...
   var actual = obj.LoadProject("UnitTest");
            Assert.AreEqual(expected, actual);


During standard program operation, even in Debug or exe mode , part of the code calls Directory.GetCurrentDirectory() + part of the path in hardcode (yes, it is necessary) to determine the path.
Usually there is a creation in Debug on D: \ project \ project \ * (the desired file)

The problem appears at the start of the Nunit test, it generally goes to drive C and in the user's directory. After some googling, I realized that there is a json file somewhere where these paths are possible. So I wanted to know how to win it? Because the tests will be run not only on my local PC.

The error itself:
61b2301353ad3657301038.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Morrowind, 2021-12-09
@hekkaaa

Until then, this is the solution. Recognize the method as "not testable".
But the method is well tested in the negative)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question