public void GetTeams_should_return_all_teams() { // Arrange var team1 = new Team() { Id = Guid.NewGuid(), Name = "Power Rangers" }; var team2 = new Team() { Id = Guid.NewGuid(), Name = "Twilight Sparkles" }; var repository = CreateTeamRepository(); repository.AddTeam(team1); repository.AddTeam(team2); // Act IEnumerable<Team> teams = repository.GetTeams(); // Assert Assert.That(teams.Count(), Is.EqualTo(2)); }
public void AddUserToTeam(Team team, User user) { if (team == null) throw new ArgumentNullException("team"); if (user == null) throw new ArgumentNullException("user"); team.UserIds.Add(user.Id); RedisTeamClient.Store(team); }
public void ScheduleJob(string jobName, string testCaseFilename, Team team, string cronTab) { // Experimental for now - uses crontab for the schedule format. IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler(); IJobDetail job = JobBuilder.Create<QuartzJob>() .WithIdentity(jobName, team.Name) .UsingJobData("TeamName", team.Name) .UsingJobData("TeamId", team.Id.ToString()) .UsingJobData("TestCaseFilename", testCaseFilename) .Build(); ITrigger trigger = TriggerBuilder.Create() .WithIdentity("trigger1", "group1") .WithCronSchedule(cronTab) .Build(); scheduler.ScheduleJob(job, trigger); }
public void AddTeam_should_store_the_team() { // Arrange var expectedTeam = new Team() { Id = Guid.NewGuid(), Name = "Power Rangers" }; var repository = CreateTeamRepository(); // Act repository.AddTeam(expectedTeam); // Assert IEnumerable<Team> teams = repository.GetTeams(); Assert.That(teams.Count(), Is.EqualTo(1)); Team actualTeam = teams.FirstOrDefault(); Assert.That(actualTeam.Id, Is.EqualTo(expectedTeam.Id)); Assert.That(actualTeam.Name, Is.EqualTo(expectedTeam.Name)); Assert.That(actualTeam.UserIds, Is.Not.Null); }
public IEnumerable<ScheduledJob> GetForTeam(Team team) { return GetAll().Where(x => x.TeamId == team.Id); }
public IEnumerable<User> GetUsersInTeam(Team team) { if (team == null) throw new ArgumentNullException("team"); return RedisUserClient.GetByIds(team.UserIds); }
public void Delete(Team team) { RedisTeamClient.Delete(team); }
public void AddTeam(Team team) { RedisTeamClient.Store(team); }
public void UpdateTeam(Team team) { RedisTeamClient.Store(team); }
public void RemoveUserFromTeam(Team team, User user) { if (team == null) throw new ArgumentNullException("team"); if (user == null) throw new ArgumentNullException("user"); team.UserIds.Remove(user.Id); RedisTeamClient.Store(team); }
private Team AddPowerRangers() { var team = new Team() { Id = Guid.NewGuid(), Name = "Power Rangers" }; using (var repository = CreateTeamRepository()) { repository.AddTeam(team); } return team; }