Exemplo n.º 1
0
        private void HandlePenaltiesThisSecond(IList <PlayEvent> eventsThatStartThisSecond, int second)
        {
            var penaltiesThatStartThisSecond = eventsThatStartThisSecond.Penalties();

            _penaltyBox.AddPenalties(penaltiesThatStartThisSecond);

            var penaltiesThatExpireThisSecond = _penaltyBox.PenaltiesThatExpireThisSecond(second);

            _penaltyBox.ExpirePenalties(penaltiesThatExpireThisSecond.ToList());

            //Logging
            foreach (var playEvent in penaltiesThatStartThisSecond)
            {
                Log(playEvent, second);
            }
            foreach (var playEvent in penaltiesThatExpireThisSecond)
            {
                Log(playEvent, second);
            }
        }
        public void FirstInFirstOut()
        {
            _penaltyBox.AddPenalties(new[] { PenaltyCreator.CreateMajor(false), PenaltyCreator.CreateMinor(false) });

            Assert.AreEqual(PlayersOnIce.FiveOnThree, _penaltyBox.PlayersOnIce);
        }
Exemplo n.º 3
0
        public void ThreeMinorsShouldPostponeLastPenalty()
        {
            _penaltyBox.AddPenalties(new[] { PenaltyCreator.CreateMinor(false), PenaltyCreator.CreateMinor(false), PenaltyCreator.CreateMinor(false) });

            Assert.AreEqual(PlayersOnIce.FiveOnThree, _penaltyBox.PlayersOnIce);
        }
        public void MinorAndMajorShouldBeFiveOnThree()
        {
            _penaltyBox.AddPenalties(new[] { PenaltyCreator.CreateMajor(false), PenaltyCreator.CreateMinor(false) });

            Assert.AreEqual(PlayersOnIce.FiveOnThree, _penaltyBox.PlayersOnIce);
        }