Exemplo n.º 1
0
        static void Main()
        {
            const int    initialScore  = 0;
            ITeamScore   homeTeamScore = new IntTeamScore(initialScore);
            INumber      zero          = new Number0();
            ITeamScore   awayTeamScore = new NoPrimitivesTeamScore(zero, zero, zero);
            IScoreKeeper scoreKeeper   = new ScoreKeeper(homeTeamScore, awayTeamScore);

            scoreKeeper.ScoreTeamA1();
            scoreKeeper.ScoreTeamA2();
            scoreKeeper.ScoreTeamA3();

            scoreKeeper.ScoreTeamB1();
            scoreKeeper.ScoreTeamB2();
            scoreKeeper.ScoreTeamB3();

            Console.WriteLine(scoreKeeper.GetScore());
        }
Exemplo n.º 2
0
        public void Score_IsExpected_AfterEachAction()
        {
            var scoreKeeper = new ScoreKeeper();
            var actions     = new[]
            {
                new ScoreAction(scoreKeeper.ScoreTeamA2, "002:000"),
                new ScoreAction(scoreKeeper.ScoreTeamB2, "002:002"),
                new ScoreAction(scoreKeeper.ScoreTeamA2, "004:002"),
                new ScoreAction(scoreKeeper.ScoreTeamA1, "005:002"),
                new ScoreAction(scoreKeeper.ScoreTeamB2, "005:004"),
                new ScoreAction(scoreKeeper.ScoreTeamA3, "008:004"),
                new ScoreAction(scoreKeeper.ScoreTeamB2, "008:006"),
                new ScoreAction(scoreKeeper.ScoreTeamA2, "010:006"),
                new ScoreAction(scoreKeeper.ScoreTeamB3, "010:009"),
                new ScoreAction(scoreKeeper.ScoreTeamB1, "010:010")
            };

            foreach (var action in actions)
            {
                action.Execute();
                scoreKeeper.GetScore().Should().Be(action.Result);
            }
        }
Exemplo n.º 3
0
        public void Score_Is000000_ByDefault()
        {
            var scoreKeeper = new ScoreKeeper();

            scoreKeeper.GetScore().Should().Be("000:000");
        }