public void LeaveRoom_ExistingRoom_RemovesUsername_ReturnIndexAction() { var mockDal = new Mock <IRoomDAL>(); var controller = new RoomsController(mockDal.Object, null); var result = controller.Leave("test-user") as RedirectToRouteResult; Assert.IsNotNull(result); Assert.AreEqual("Index", result.RouteValues["action"]); Assert.AreEqual("Rooms", result.RouteValues["controller"]); mockDal.Verify(m => m.LeaveChatRooms("test-user")); }