I have this small method written in ASP.Net Core on .Net Core 1.1 framework:
public class AccountController : Controller
{
public IActionResult Logout()
{
HttpContext.Authentication.SignOutAsync("SchemaName");
HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return RedirectToAction("Index", "Home");
}
}
I am struggling a lot with how to write a unit test that verifies that this method returns a RedirectToActionResult and tried many different approaches based on both old and relative new information found here and there. The problem is that HttpContext is null and I have been unsuccessful in mocking it.
Any help in writing this test would be greatly appreciated!