public static ICollection <ApplicationUser> GetFollowedUsers(this FollowsServiceTests tests) { var rng = new Random(); var users = ApplicationUsersServiceDataHelper.GetUsers(null) .OrderBy(_ => rng.Next()) .ToList(); return(users .Select(x => { var usersWithoutMe = users.Where(y => y.Id != x.Id).ToList(); x.Followers.Add(new Follow { FollowerId = usersWithoutMe[rng.Next(0, usersWithoutMe.Count)].Id, FollowedId = x.Id, }); x.Followings.Add(new Follow { FollowerId = x.Id, FollowedId = usersWithoutMe[rng.Next(0, usersWithoutMe.Count)].Id, }); return x; }) .ToList()); }
public static (ICollection <ApplicationUser> Users, ICollection <Badge> Badges) GetUsersWithBadges(this BadgesServiceTests tests) { var rng = new Random(DateTime.UtcNow.Millisecond); var badges = GetBadges(null).OrderBy(_ => rng.Next()).ToList(); var users = ApplicationUsersServiceDataHelper.GetUsers(null) .Select(x => { for (int i = 0; i < rng.Next(1, badges.Count); i++) { x.Badges.Add(badges[rng.Next(0, badges.Count)]); } x.Badges = x.Badges.Distinct().ToList(); return(x); }) .OrderBy(_ => rng.Next()) .ToList(); return(users, badges); }