I have an export class that takes HttpContext as a parameter in the constructor.
public ExportClass(IExportProp IE, HttpContext x)
{
this._Iexport = IE;
this._pg = x;
}
I am trying to create an Instance of this class in my Unit Test, but I am not able to use HttpContext in Unit Test.
[TestClass]
public class ExportClass_Test
{
ExportClass exportClass;
private IExportProp _iep;
[ClassInitialize]
public void TestSetup()
{
var ctx = System.Web.HttpContext.Current;//Error: The type or namespace name 'HttpContext' does not exist in the namespace 'System.Web' (are you missingan assembly reference?)
exportClass = new ExportClass();// I need to pass the HttpContext here, but I get get the above error on my HttpContext
}
}
I added using System.Web, but this does not solve the issue. Is there a simple way to pass an HttpContext this way, or, what is the proper way to accomplish this?