lundi 30 mai 2016

Using Server.Mappath in a Unit Testing project

I am planning to write unit test for a web api function which is using a line of code to load XML file using Server.MapPath

While running from UnitTest project same returns null to me .

One solution to this issue is pass filename to the function from the controller So i can use Context.Current,Server.MapPath while running the web api project and while running from unit test i can use a hardcoded file path,

Is there any other way so that i can use the same line of code for both UnitTest and actual Web api endpoint call

Aucun commentaire:

Enregistrer un commentaire