How can I load this file into an NUnit Test?

后端 未结 4 1669
温柔的废话
温柔的废话 2020-12-23 19:19

I have the following IntegrationTest project structure ...

\"enter

If i wish t

4条回答
  •  忘掉有多难
    2020-12-23 19:59

    Found a gotcha with using TestContext.CurrentContext.TestDirectory. This works perfectly in a Setup, but when I call it from within a method supplied to a TestCaseSource, the static method is called before all other code, and returns the following:

    C:\Users\\.nuget\packages\nunit\3.10.1\lib\netstandard2.0
    

    However, using TestContext.CurrentContext.WorkDirectory gives the desired result in both places:

    C:\SVN\MyApp\trunk\MyApp.Tests\bin\Debug\netcoreapp2.1
    

提交回复
热议问题