コード例 #1
0
ファイル: PrepareUserDtoTest.cs プロジェクト: q3abhi/library
        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");
        }
コード例 #2
0
ファイル: UserService.cs プロジェクト: q3abhi/library
        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;
            }
        }