예제 #1
0
        public void LogOutUserTest()
        {
            LoginDTO loginUser = new LoginDTO();

            loginUser.UserName = "******";
            loginUser.Password = "******";

            UserDTO userDTO = new UserDTO();

            userDTO.Name     = "Pepe";
            userDTO.LastName = "Perez";
            userDTO.UserName = "******";
            userDTO.Phone    = 091234567;
            userDTO.Password = "******";
            userDTO.Role     = "Administrador";

            var mockUserDAO = new Mock <UserDAO>();

            mockUserDAO.Setup(us => us.LogIn(loginUser)).Returns(userDTO);

            var userService = new UserServiceImpl(mockUserDAO.Object);

            UserLoggedDTO result = userService.LogIn(loginUser);

            userService.LogOut(result.Token);

            UserDTO resultUser = userService.GetUserLoggedIn(result.Token);
        }
예제 #2
0
        public void UserNotLoggedInTest()
        {
            Guid id          = Guid.NewGuid();
            var  userService = new UserServiceImpl(null);

            UserDTO resultUser = userService.GetUserLoggedIn(id);
        }