Esempio n. 1
0
        public void Join(Participant participant)
        {
            if (_participants.Any(p => p.Id.Equals(participant.Id)))
                throw new ParticipantAlreadyParticpatesInRoundException(participant.Id, participant.Name);

            _participants.Add(participant);
            participant.Estimated += RegisterEstimate;
        }
Esempio n. 2
0
        public void Remove(Participant participant)
        {
            var idOfParticipantToRemove = participant.Id;
            var participantToRemove = _participants.SingleOrDefault(p => p.Id.Equals(idOfParticipantToRemove));
            if (participantToRemove == null)
                throw new NoSuchParticipantException(idOfParticipantToRemove);

            participant.Estimated -= RegisterEstimate;
            _participants.Remove(participant);
        }
Esempio n. 3
0
        public void Can_enroll_new_participant_when_there_is_no_active_round()
        {
            var roundKeeper = new RoundKeeper();
            var participant = new Participant("NEW");

            roundKeeper.Enroll(participant);

            Assert.That(roundKeeper.HasActiveRound, "roundkeeper has active round");
            Assert.That(roundKeeper.ActiveRound.Status.ParticipantCount, Is.EqualTo(1), "round participant count");
        }
Esempio n. 4
0
        public void Can_enroll_new_participant_when_there_is_an_active_non_completed_round()
        {
            var roundKeeper = new RoundKeeper();
            var participant1 = new Participant("ONE");
            var participant2 = new Participant("TWO");
            roundKeeper.Enroll(participant1);

            roundKeeper.Enroll(participant2);

            Assert.That(roundKeeper.ActiveRound.Status.ParticipantCount, Is.EqualTo(2), "round participant count");
        }
Esempio n. 5
0
        public void Starts_new_round_when_enrolling_new_participant_when_active_roud_is_completed()
        {
            var roundKeeper = new RoundKeeper();
            var currentRoundParticipant = new Participant("ACTIVE");
            var newRoundInitiatingParticipant = new Participant("NEW");
            roundKeeper.Enroll(currentRoundParticipant);
            currentRoundParticipant.Estimate(StoryPoints.One);

            roundKeeper.Enroll(newRoundInitiatingParticipant);

            Assert.That(roundKeeper.ActiveRound.Status.ParticipantCount, Is.EqualTo(2), "participant count");
            Assert.That(roundKeeper.ActiveRound.Status.EstimateCount, Is.EqualTo(0), "estimate count");
        }
Esempio n. 6
0
        public ActionResult Index(RegisterForm form)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Name is required!");
                return View(form);
            }

            var participant = new Participant(form.Name);

            _roundKeeper.Enroll(participant);
            _appCookies.ParticipantId = participant.Id;

            return RedirectToAction("Estimate", "Estimation");
        }
Esempio n. 7
0
        public void Enroll(Participant participant)
        {
            if (!HasActiveRound)
            {
                StartNewRound(participant);
                return;
            }

            if (_activeRound.Status.IsCompleted)
            {
                var newRoundParticipants = _activeRound.Partipants.Union(new[] {participant}).ToArray();
                StartNewRound(newRoundParticipants);
            } else
            {
                participant.Participate(_activeRound);
            }
        }
Esempio n. 8
0
 public static Participant In(EstimationRound round, string name = "anonymous")
 {
     var participant = new Participant(name);
     participant.Participate(round);
     return participant;
 }
Esempio n. 9
0
 private void StartNewRound(Participant participant)
 {
     StartNewRound(new []{participant});
 }
Esempio n. 10
0
 private void StartNewRound(Participant participant)
 {
     StartNewRound(new [] { participant });
 }