public void User_SignOut_Redirects_To_Login() { // Arrange var auth = new Mock<IAuth>(); var userService = new Mock<IUserService>(); var controller = new UserController(userService.Object); // Act var result = controller.SignOut(); // Assert Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult)); }
public void User_SignIn_Returns_View() { // Arrange var auth = new Mock<IAuth>(); var userService = new Mock<IUserService>(); var controller = new UserController(userService.Object); // Act var result = (ViewResult)controller.SignIn(); // Assert Assert.AreEqual(result.ViewName, "SignIn"); }
public void User_SignOut_Displays_Message() { // Arrange var auth = new Mock<IAuth>(); var userService = new Mock<IUserService>(); var controller = new UserController(userService.Object); // Act var result = (RedirectToRouteResult)controller.SignOut(); // Assert Assert.AreNotEqual(String.Empty, result.RouteValues["message"]); }
public void User_EditProfile_Returns_EditProfile_View() { // Arrange var auth = new Mock<IAuth>(); var userService = new Mock<IUserService>(); var controller = new UserController(userService.Object); controller.CurrentUser = new User { Email = "*****@*****.**" }; // Act var result = (ViewResult)controller.EditProfile(); // Assert Assert.AreEqual(result.ViewName, "EditProfile"); }