public void CloseSession(int id) { Session session = _dummyContext.Sessions.First(s => s.SessionId == id); _mockSessionRepository.Setup(s => s.GetById(id)).Returns(session); _sessionController.OpenSession(id); Assert.True(session.IsOpened); var result = Assert.IsType <RedirectToActionResult>(_sessionController.CloseSession(id)); Assert.False(session.IsOpened); _mockSessionRepository.Verify(m => m.SaveChanges(), Times.Exactly(2)); }
public ActionResult LogOff() { SessionController.CloseSession(); return(RedirectToAction("Index", "Login")); }