コード例 #1
0
        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));
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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"]);
        }
コード例 #4
0
        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");
        }