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));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
 }
Exemplo n.º 6
0
        public IEnumerable<User> GetUsersInTeam(Team team)
        {
            if (team == null)
                throw new ArgumentNullException("team");

            return RedisUserClient.GetByIds(team.UserIds);
        }
Exemplo n.º 7
0
 public void Delete(Team team)
 {
     RedisTeamClient.Delete(team);
 }
Exemplo n.º 8
0
 public void AddTeam(Team team)
 {
     RedisTeamClient.Store(team);
 }
Exemplo n.º 9
0
 public void UpdateTeam(Team team)
 {
     RedisTeamClient.Store(team);
 }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        private Team AddPowerRangers()
        {
            var team = new Team()
            {
                Id = Guid.NewGuid(),
                Name = "Power Rangers"
            };

            using (var repository = CreateTeamRepository())
            {
                repository.AddTeam(team);
            }

            return team;
        }