コード例 #1
0
        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));
        }
コード例 #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);
        }
コード例 #3
0
ファイル: Scheduler.cs プロジェクト: pawelkmiec/syringe
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public IEnumerable<ScheduledJob> GetForTeam(Team team)
 {
     return GetAll().Where(x => x.TeamId == team.Id);
 }
コード例 #6
0
        public IEnumerable<User> GetUsersInTeam(Team team)
        {
            if (team == null)
                throw new ArgumentNullException("team");

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

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

            return team;
        }