コード例 #1
0
        public void StandartEmailHideTest(string email, string expected)
        {
            // act
            string actual = EmailHider.Hide(email);

            // assert
            Assert.Equal(expected, actual);
        }
コード例 #2
0
ファイル: UserRepository.cs プロジェクト: SGmuwa/InWords
        public User GetUserAccount(int key)
        {
            User user = GetWithInclude(u => u.UserId.Equals(key), us => us.Account).SingleOrDefault();

            if (user is null)
            {
                return(null);
            }

            user.Account.Hash  = null;
            user.Account.Email = EmailHider.Hide(user.Account.Email);
            user.Account.User  = null;
            return(user);
        }
コード例 #3
0
        public static IEnumerable <ProfileReply> GetProfile(this InWordsDataContext context, Expression <Func <User, bool> > predicate)
        {
            if (context == null)
            {
                return(Array.Empty <ProfileReply>());
            }

            return(from user in context.Users.Where(predicate)
                   join account in context.Accounts on user.UserId equals account.AccountId
                   select new ProfileReply()
            {
                UserId = user == null ? 0 : user.UserId,
                Email = account == null || account.Email == null
                        ? "*@*" : EmailHider.Hide(account.Email),
                Experience = user == null ? 0 : user.Experience,
                LastLogin = user == null ? "" : user.LastLogin.ToString("o", CultureInfo.InvariantCulture),
                NickName = user == null ? "" : user.NickName,
                AvatarPath = user == null || string.IsNullOrWhiteSpace(user.AvatarPath) ?
                             "" : user.AvatarPath,
                RegistrationDate = account == null || account.RegistrationDate == null ?
                                   "" : account.RegistrationDate.ToString("o", CultureInfo.InvariantCulture),
                Role = account == null ? "-/-" : Strings.GetDetailMessage(Locale.RuRu, account.Role)
            });
        }