Beispiel #1
0
        public void TestPrepare()
        {
            User user = new User();

            user.Username = "******";
            user.Password = "******";

            IUserDal dal =new UserDal();
            User returnedUser = dal.ValidateUser(user);
            prepareDto = new PrepareUserDto();
            UserDto dto = prepareDto.Prepare(returnedUser);

            Console.Write(dto.Name);

            String[] mem = dto.Memberships;

            for (int count = 0; count < mem.Length; count++)
            {
                Console.Write(mem[count]);
            }

            for (int i = 0; i < dto.Tokens.Count; i++)
            {
                Console.WriteLine(dto.Tokens[i]);
            }

            Assert.IsNotNull(dto,"Should not be null");
        }
Beispiel #2
0
        public UserDto ValidateUser(string username, string password)
        {
            User user = new User();

            user.Username = username;
            user.Password = password;

            IUserDal userdal = new UserDal();
            User returnedUser = userdal.ValidateUser(user);

            if (returnedUser == null)
            {
                return null;
            }
            else
            {
                IPrepareUserDto prepareUserDto = new PrepareUserDto();
                UserDto userdto = prepareUserDto.Prepare(returnedUser);
                return userdto;
            }
        }