I have a controller with the Authorize attribute:
public CustomerController:Controller
{
[Authorize]
public ActionResult GetCustomer(int id)
{
var model=db.Customers.where(c=>c.id==id);
return View(model);
}
}
My question is, how can I test a controller with the Authorize attribute?
Do we need to get user information like username and password before testing from HttpContext?
Are mocks, dependency injection, and inversion of control related to unit testing? If so, can you guys suggest some websites or documents for learning these topics?