/// <summary> /// /// </summary> /// <param name="dc"></param> public static void AddTeamMembers(this DataContext dc) { var repo = new TeamRepository(dc); var users = new UserRepository(dc).All.Value; var teams = dc.Teams.ToList(); foreach (var t in teams) { var count = TestFactory.GetRandomUShort(( ushort )users.Count); TestFactory .SelectRandomObjects <ModelUser>(users, count) .Select(x => x.Id) .ToList() .ForEach(x => repo .ForActiveOrg(t.OrgId) .AddMember(t.Id, x)); } }
/// <summary> /// /// </summary> /// <param name="dc"></param> public static ModelFolders AddFolders(this DataContext dc, int fCount = 5) { var repo = new TeamRepository(dc); var folders = TestFactory.Create <ModelFolder>(fCount); var orgs = dc .Orgs .Select(x => x.ToModel()) .ToList(); foreach (var f in folders) { var o = TestFactory.SelectRandomObject <ModelOrg>(orgs); //t.Name = $"{o.Name.Substring( 0, 3 )}-{t.Name}"; GetRepo <FolderRepository>(dc) .ForActiveOrg(o.Id) .Create(f); } return(folders); }
/// <summary> /// /// </summary> /// <param name="dc"></param> public static ModelTeams AddTeams(this DataContext dc, int count = 10) { var repo = new TeamRepository(dc); var teams = TestFactory.Create <ModelTeam>(count); var orgs = dc .Orgs .Select(x => x.ToModel()) .ToList(); foreach (var t in teams) { var o = TestFactory.SelectRandomObject <ModelOrg>(orgs); t.Name = $"{o.Name.Substring( 0, 3 )}-{t.Name}"; GetRepo <TeamRepository>(dc) .ForActiveOrg(o.Id) .Create(t); } return(teams); }