I have a method. In it I am retrieving a file and reading its bytes. Its a certificate file. var readAllBytes = File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/") + "Certificates\\Mynew.pfx");
MethodA()
{
var readAllBytes = File.ReadAllBytes(HttpContext.Current.Server.MapPath("~/") + "Certificates\\Mynew.pfx");`
...
}
I am writing a unit test for this MethodA. As you can see when I hit the readAllBytes line it exceptions out. How do I over-come this. Please let me know if you need any info.
Object reference not set to an instance of an object.
Since I dont have the file path when my debug point reaches that line it throws up the above exception.