in one of my model classes, I have a property:
public virtual bool OkToChangeApprovedForPayment
{
get
{
return ExportedDateTime == null && PMApproved == true && HttpContext.Current.User.IsInRole(Resources.Roles.VectorOpsAdmin);
}
}
As you can see, one of the conditions is to check the role the user is in. Is it possible to access the HttpContext in the model as follows? If this is not the best way to do this?
If this is normal, how would you unit test it? How do you replace the call with an HttpContext?
source
share