public void DoubleMinorPlusDoubleMinorAndMajorPlusDoubleMinorPlusMinorShouldBeFourOnFourForTwoMinutes()
        {
            _penaltyBox.AddPenalties(new[] { PenaltyCreator.CreateDoubleMinor(true), PenaltyCreator.CreateDoubleMinor(true), PenaltyCreator.CreateMajorAndGame(false), PenaltyCreator.CreateDoubleMinor(false), PenaltyCreator.CreateMinor(false) });

            Assert.AreEqual(PlayersOnIce.FourOnFour, _penaltyBox.PlayersOnIce);

            //Expire minors
            var ex = _penaltyBox.PenaltiesThatExpireThisSecond(220).ToList();

            _penaltyBox.ExpirePenalties(ex);

            Assert.AreEqual(PlayersOnIce.FiveOnFour, _penaltyBox.PlayersOnIce);

            //Expire Major
            var ex2 = _penaltyBox.PenaltiesThatExpireThisSecond(400).ToList();

            _penaltyBox.ExpirePenalties(ex2);

            Assert.AreEqual(PlayersOnIce.FiveOnFive, _penaltyBox.PlayersOnIce);

            //Assert.AreEqual(2, _penaltyBox.PenaltyScoreBoard.Home.Count());
            //Assert.AreEqual(340, _penaltyBox.PenaltyScoreBoard.Home.Last().EndTime);
        }
Ejemplo n.º 2
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);
            }
        }