0
我編寫了一個使用data source
屬性的單元測試。 到現在爲止,我一直在使用完整路徑,但我想用相對路徑替換它。單元測試中數據源中的相對路徑
但是從C所執行的測試運行:\程序文件(x86)\微軟的Visual Studio 10.0 \ Common7 \ IDE \ MSTest.exe,用我的單元測試爲DLL。 我想從單元測試的位置得到相對路徑。
使用方法或道具像Environment.CurrentDirectory
拋編譯錯誤:
An attribute argument must be a constant expression, typeof expression
or array creation expression of an attribute parameter
我還發現變量| DataDirectory
|但它並沒有帶來真正的道路。
例如:
my unit test location is
c:\theproject\source\test\unittest\MyUnitTest.dll
and my excel file location is
c:\theproject\source\test\helpfiles\MyExcelFile.xlsx
我應該怎麼辦?