c# - Functional Tests getting a file from App_Data Folder -
i writing functional tests , method writing tests has access file in app_data folder. have tried
system.web.httpcontext.current.server.mappath("~/app_data/test.txt");
as
path.combine(environment.getfolderpath(environment.specialfolder.applicationdata), "test.txt");
both of them not working. there way achieve in functional test?
any ideas in regard appreciated.
thanks,
raja
i found solution @ last (with of solutions architect). set app config functional test project , set file name 1 of appsettings. after specified relative path actual file
[deploymentitem(@"..\..\project1\app_data\test.txt")]
attribute test class. added simple hack use absolute path if in test (app config) ,
server.mappath("test.txt")
if not test. logic solution since put file deploymentitem goes straight respective testresults folder if use absolute path going able reference it.
hope helps someone.
Comments
Post a Comment