public void TestThatUpdateToClosedAssessmentThrowsException() { var team = new Data.Team(); team.TeamMembers.Add(new Data.TeamMember() { UserId = TestUser }); _mockContainer.Teams.Add(team); _mockContainer.Assessments.Add(new Data.Assessment() { Id = 1, Status = new Data.AssessmentStatus() { Value = "Closed" }, Team = team }); var result = new Continuum.Core.Models.AssessmentResult(); result.AssessmentId = 1; _assessmentController.Put(new List <Continuum.Core.Models.AssessmentResult>() { result }); }
private void CreateTeamsAndGame(GamePoolContext context, string bowlName, string teamA, string teamB, string network, string gameDateTime) { Team t1 = new Data.Team() { Id = Guid.NewGuid().ToString(), Description = (string.IsNullOrEmpty(teamA)) ? $"{bowlName} Home" : teamA }; Team t2 = new Data.Team() { Id = Guid.NewGuid().ToString(), Description = (string.IsNullOrEmpty(teamB)) ? $"{bowlName} Home" : teamB }; Game g1 = new Data.Game() { HomeTeamId = t1.Id, AwayTeamId = t2.Id, Description = bowlName, Network = network, GameDateTime = gameDateTime, Id = Guid.NewGuid().ToString(), AwayScore = 0, HomeScore = 0 }; context.Teams.Add(t1); context.Teams.Add(t2); context.Games.Add(g1); }
// ReSharper disable once UnusedMember.Global public void Construct(Data.Team data, BattleUnitFactory battleUnitFactory) { _data = data; _battleUnitFactory = battleUnitFactory; CampType = _data.CampType; }
public Team(Data.Team t, Data.TeamAffiliation a) { group_ids = new[] { $"{t.CategoryId}" }; organization_id = a.ExternalId; id = $"{t.TeamId}"; name = t.TeamName; externalid = $"team{t.TeamId}"; icpc_id = $"team{t.TeamId}"; affiliation = a.FormalName; }
private Data.Assessment GetCurrentAssessmentForTeam(Data.Team team) { var assessment = _assessmentRepo.GetCurrentAssessmentForTeam(team.Id); if (assessment == null) { throw new ApplicationException("No assessment data is available for this team."); } return(assessment); }
private static object convertTeamToModel(object src) { p1p.Types.DTO.TeamDTO dto = (p1p.Types.DTO.TeamDTO)src; p1p.Data.Team mdl = new Data.Team(); mdl.Id = dto.Id; mdl.Name = dto.Name; mdl.InsertDate = dto.InsertDate; return(mdl); }
private void CreateTeamAndTeamMember(out Data.Team team, out Data.TeamMember teamMember) { team = new Data.Team() { Id = 1 }; teamMember = new Data.TeamMember() { UserId = TestUser, Id = 1 }; teamMember.Team = team; teamMember.TeamId = team.Id; team.TeamMembers.Add(teamMember); _mockContainer.Teams.Add(team); _mockContainer.TeamMembers.Add(teamMember); }
private void CreateTeamWithMember() { var teamMember = new Data.TeamMember() { UserId = "TestUser" }; var team = new Data.Team() { Id = 0 }; team.TeamMembers.Add(teamMember); teamMember.Team = team; _mockContainer.Teams.Add(team); _mockContainer.TeamMembers.Add(teamMember); }
Schedule IFantasyDataProvider.GetSchedule() { List <Data.Team> teams = Data.CsvObjectLoader.LoadObjects <Data.Team>(@"Data\Local\Team.csv"); Teams = teams.Select(t => new FantasyFootball.Team(t.Name)).ToList(); List <Data.Matchup> matchups = Data.CsvObjectLoader.LoadObjects <Data.Matchup>(@"Data\Local\Matchup.csv"); List <Data.ScoreInformation> scoreInfo = Data.CsvObjectLoader.LoadObjects <Data.ScoreInformation>(@"Data\Local\ScoreInformation.csv"); Schedule schedule = new Schedule { Teams = Teams }; foreach (var match in matchups) { Data.Team dataTeam1 = teams.First(t => t.Id == match.Team1Id); Data.ScoreInformation dataScoreInfo1 = scoreInfo.First(i => i.TeamId == dataTeam1.Id && i.MatchupId == match.Id); Data.Team dataTeam2 = teams.First(t => t.Id == match.Team2Id); Data.ScoreInformation dataScoreInfo2 = scoreInfo.First(i => i.TeamId == dataTeam2.Id && i.MatchupId == match.Id); FantasyFootball.Team team1 = schedule.Teams.First(team => team.Name == dataTeam1.Name); MatchupTeamInfo team1Info = new MatchupTeamInfo(team1, dataScoreInfo1.ActualScore, dataScoreInfo1.ProjectedScore); FantasyFootball.Team team2 = schedule.Teams.First(team => team.Name == dataTeam2.Name); MatchupTeamInfo team2Info = new MatchupTeamInfo(team2, dataScoreInfo2.ActualScore, dataScoreInfo2.ProjectedScore); FantasyFootball.Matchup matchup = new FantasyFootball.Matchup(team1Info, team2Info); Week thisWeek = schedule.Weeks.FirstOrDefault(w => w.WeekNumber == match.WeekNum); if (thisWeek == null) { schedule.Weeks.Add(new Week { WeekNumber = match.WeekNum, Matchups = new List <FantasyFootball.Matchup> { matchup } }); } else { thisWeek.Matchups.Add(matchup); } } return(schedule); }
private static BurndownModel GenerateBurndownModel(Data.Team team, Burndown burndown) { var burndownModel = new BurndownModel() { Areas = team.AreaLabels.OrderBy(l => l).ToList(), Weeks = new List <WeekBurndownModel>(), }; foreach (var week in burndown.Weeks) { var weekModel = new WeekBurndownModel() { Date = week.EndDate.ToString("yyyy-MM-dd"), Areas = new List <AreaBurndownModel>(), }; var areaDict = week.Areas.ToDictionary(a => a.Label); foreach (var area in burndownModel.Areas) { AreaBurndownModel areaModel; if (areaDict.TryGetValue(area, out var areaBurndown)) { areaModel = new AreaBurndownModel() { Label = area, Open = areaBurndown.Open, Closed = areaBurndown.Closed, Accepted = areaBurndown.Accepted, }; } else { areaModel = new AreaBurndownModel() { Label = area, Open = 0, Closed = 0, Accepted = 0, }; } weekModel.Areas.Add(areaModel); } burndownModel.Weeks.Add(weekModel); } return(burndownModel); }
public Team CreateTeam(Team team) { if (_teamRepo.All().Any(i => i.Name == team.Name.Trim())) { throw new ApplicationException(string.Format("A Team called {0} already exists.", team.Name)); } Data.AvatarType avatar = null; if (!String.IsNullOrEmpty(team.AvatarName)) { avatar = _teamRepo.GetAvatar(team.AvatarName); } else { avatar = _teamRepo.GetDefaultAvatar(); } Data.Team newTeam = new Data.Team() { Name = team.Name, AvatarType = avatar }; newTeam.TeamMembers.Add(new Data.TeamMember() { UserId = CurrentUserName, IsAdmin = true }); _teamRepo.Create(newTeam); _teamRepo.SaveChanges(); return(new Team() { AvatarName = newTeam.AvatarType.Value, Id = newTeam.Id, Name = newTeam.Name, TeamLeadName = newTeam.TeamMembers.Where(i => i.IsAdmin).First().UserId }); }
public MockTeamMembersDBSet() { var team = new Data.Team() { Id = 1, Name = "Test Team", AvatarType = new AvatarType() { Value = "Avatar" } }; var teamMember = new TeamMember() { UserId = "*****@*****.**", IsAdmin = true, Team = team, TeamId = team.Id }; team.TeamMembers.Add(teamMember); Add(teamMember); }
public Team CreateTeam(Team team) { if (_teamRepo.All().Any(i => i.Name == team.Name.Trim())) { throw new ApplicationException(string.Format("A Team called {0} already exists.", team.Name)); } Data.AvatarType avatar = null; if(!String.IsNullOrEmpty(team.AvatarName)) { avatar = _teamRepo.GetAvatar(team.AvatarName); } else { avatar = _teamRepo.GetDefaultAvatar(); } Data.Team newTeam = new Data.Team() { Name = team.Name, AvatarType = avatar }; newTeam.TeamMembers.Add(new Data.TeamMember() { UserId = CurrentUserName, IsAdmin = true }); _teamRepo.Create(newTeam); _teamRepo.SaveChanges(); return new Team() { AvatarName = newTeam.AvatarType.Value, Id = newTeam.Id, Name = newTeam.Name, TeamLeadName = newTeam.TeamMembers.Where(i => i.IsAdmin).First().UserId }; }
public static async Task <StatusReportModel> GenerateReportModelAsync(GitHubClient github, DataStore data, Data.Team team, string milestone, DateTime startDate, DateTime endDate, ILoggerFactory loggerFactory) { var logger = loggerFactory.CreateLogger <StatusReport>(); var model = new StatusReportModel(); model.Name = team.Name; model.ReportDate = endDate.ToString("yyyy-MM-dd"); var cache = new GitHubCache(github, data, loggerFactory.CreateLogger <GitHubCache>()); // Establish the time window. Exclude the endDate. var range = new DateRange(startDate, endDate.AddDays(-1)); logger.LogInformation("Using date range {Range}", range); var releaseMilestone = data.GetMilestone(milestone); model.Milestone = new List <MilestoneDates>() { ComputeMilestoneDates(data, endDate, releaseMilestone, logger) }; var repos = new RepositoryCollection(); foreach (var repo in data.Organization.Repositories) { repos.Add(repo.Owner, repo.Name); } await GeneratePullRequestInfoAsync(github, data, team, model, cache, range, repos, logger); await GenerateIssueInfoAsync(github, team, repos, milestone, model, logger); // Try to render burndown data var burndown = await data.LoadBurndownAsync(milestone); // Check for burndown data for the end date if (!burndown.Weeks.Any(w => w.EndDate.Year == endDate.Year && w.EndDate.Month == endDate.Month && w.EndDate.Day == endDate.Day)) { logger.LogWarning("No burndown data is associated with today's date! The burndown data in this report may be out-of-date."); } model.Burndown = GenerateBurndownModel(team, burndown); return(model); }
private void CreateTeamAndTeamMember(out Data.Team team, out Data.TeamMember teamMember) { team = new Data.Team() { Id = 1 }; teamMember = new Data.TeamMember() { UserId = TestUser, Id = 1 }; teamMember.Team = team; teamMember.TeamId = team.Id; team.TeamMembers.Add(teamMember); _mockContainer.Teams.Add(team); _mockContainer.TeamMembers.Add(teamMember); }
public void TestThatUpdateToClosedAssessmentThrowsException() { var team = new Data.Team(); team.TeamMembers.Add(new Data.TeamMember() { UserId = TestUser }); _mockContainer.Teams.Add(team); _mockContainer.Assessments.Add(new Data.Assessment() { Id = 1, Status = new Data.AssessmentStatus() { Value = "Closed" }, Team = team }); var result = new Continuum.Core.Models.AssessmentResult(); result.AssessmentId = 1; _assessmentController.Put(new List<Continuum.Core.Models.AssessmentResult>() { result }); }
public PlayerPrompt(bool homeTeam, ref Data.Team teamPassed) { InitializeComponent(); team = teamPassed; if (homeTeam) { Prompt_Label.Text = "Please enter players for the home team."; homeTeamVar = homeTeam; } else { Prompt_Label.Text = "Please enter players for the away team."; homeTeamVar = homeTeam; } // Indices 0-2 textBoxes.Add(Pitcher_FirstName_TextBox); textBoxes.Add(Pitcher_LastName_TextBox); textBoxes.Add(Pitcher_Number_TextBox); // Indices 3-5 textBoxes.Add(Catcher_FirstName_TextBox); textBoxes.Add(Catcher_LastName_TextBox); textBoxes.Add(Catcher_Number_TextBox); // Indices 6-8 textBoxes.Add(First_FirstName_TextBox); textBoxes.Add(First_LastName_TextBox); textBoxes.Add(First_Number_TextBox); // Indices 9-11 textBoxes.Add(Second_FirstName_TextBox); textBoxes.Add(Second_LastName_TextBox); textBoxes.Add(Second_Number_TextBox); // Indices 12-14 textBoxes.Add(Third_FirstName_TextBox); textBoxes.Add(Third_LastName_TextBox); textBoxes.Add(Third_Number_TextBox); // Indices 15-17 textBoxes.Add(Shortstop_FirstName_TextBox); textBoxes.Add(Shortstop_LastName_TextBox); textBoxes.Add(Shortstop_Number_TextBox); // Indices 18-20 textBoxes.Add(Left_FirstName_TextBox); textBoxes.Add(Left_LastName_TextBox); textBoxes.Add(Left_Number_TextBox); // Indices 21-23 textBoxes.Add(Center_FirstName_TextBox); textBoxes.Add(Center_LastName_TextBox); textBoxes.Add(Center_Number_TextBox); // Indices 24-26 textBoxes.Add(Right_FirstName_TextBox); textBoxes.Add(Right_LastName_TextBox); textBoxes.Add(Right_Number_TextBox); // Indices 27-29 textBoxes.Add(BenchFirst_FirstName_TextBox); textBoxes.Add(BenchFirst_LastName_TextBox); textBoxes.Add(BenchFirst_Number_TextBox); // Indices 30-32 textBoxes.Add(BenchSecond_FirstName_TextBox); textBoxes.Add(BenchSecond_LastName_TextBox); textBoxes.Add(BenchSecond_Number_TextBox); // Indices 33-35 textBoxes.Add(BenchThird_FirstName_TextBox); textBoxes.Add(BenchThird_LastName_TextBox); textBoxes.Add(BenchThird_Number_TextBox); // Indices 36-38 textBoxes.Add(BenchFourth_FirstName_TextBox); textBoxes.Add(BenchFourth_LastName_TextBox); textBoxes.Add(BenchFourth_Number_TextBox); }
private void CreateTeamWithMember() { var teamMember = new Data.TeamMember() { UserId = "TestUser" }; var team = new Data.Team() { Id = 0 }; team.TeamMembers.Add(teamMember); teamMember.Team = team; _mockContainer.Teams.Add(team); _mockContainer.TeamMembers.Add(teamMember); }