How to refer to test files from Xunit tests in Visual Studio?

前端 未结 4 935
抹茶落季
抹茶落季 2021-02-03 21:34

We’re using Xunit for testing. We’re running our tests via the built-in Visual Studio 2013 Test Runner, using the Xunit plugin.

The issue is that some of the tests need

4条回答
  •  时光取名叫无心
    2021-02-03 22:00

    After a bit of search I found the solution here: https://msdn.microsoft.com/en-us/library/ms182475.aspx.

    Particularly, the first step has been enough for me:

    If they are specific to one test project, include them as content files in the Visual Studio test project. Select them in Solution Explorer and set the Copy to Output property to Copy if Newer.

    associated to the following code:

    var filename = "./Resources/fake.pdf"
    File.OpenRead(filename)
    

提交回复
热议问题