Esempio n. 1
0
        private List <PlayerResultScore> ResultScoreMockPlayerB(Player player, Guid gameId, Guid matchId)
        {
            var score1 = new PlayerResultScore(player, matchId, gameId, 2, 3);
            var clc    = new MortalKombatPointCalculator(3, 2, 0, 0);

            score1.SetPointsTaken(clc);
            score1.SetPointsLost(clc);

            var score2 = new PlayerResultScore(player, matchId, gameId, 3, 1);

            clc = new MortalKombatPointCalculator(3, 3, 5, 0);
            score2.SetPointsTaken(clc);
            score2.SetPointsLost(clc);

            var score3 = new PlayerResultScore(player, matchId, gameId, 1, 3);

            clc = new MortalKombatPointCalculator(3, 1, 6, 6.2);
            score2.SetPointsTaken(clc);
            score2.SetPointsLost(clc);

            List <PlayerResultScore> scores = new List <PlayerResultScore> {
                score1, score2, score3
            };

            return(scores);
        }
Esempio n. 2
0
        public void HaveA_Winner()
        {
            Player playerA = new Player(Guid.NewGuid())
            {
                Name = "A"
            };
            Player playerB = new Player(Guid.NewGuid())
            {
                Name = "B"
            };
            Game           g        = new Game(Guid.NewGuid(), "Mortal Kombat");
            DateTime       tomorrow = DateTime.Now.AddDays(1);
            Match <Player> theMatch = new Match <Player>(Guid.NewGuid(), g.Id, playerA, playerB, g, tomorrow);

            int roundsWon  = 3;
            int roundsLost = 2;
            MortalKombatPointCalculator     mkCalculator = new MortalKombatPointCalculator(roundsWon, playerB.TotalScoreIn(g.Id), playerA.TotalScoreIn(g.Id));
            MortalKombatWinnerSpecification mkSpecs      = new MortalKombatWinnerSpecification(roundsWon, roundsLost, mkCalculator);

            var result = theMatch.Result();

            playerA.Won(result, mkSpecs);
            playerB.Lost(result, mkSpecs);

            result.Winner.Should().Be(playerA);
            result.Loser.Should().Be(playerB);
        }
Esempio n. 3
0
        public void MortalKombatLoseScoreTest_2()
        {
            int    roundsWon     = 2;
            int    roundsLost    = 3;
            double myScore       = 20;
            double opponentScore = 10;

            MortalKombatPointCalculator     mkCalculator = new MortalKombatPointCalculator(roundsWon, opponentScore, myScore);
            MortalKombatWinnerSpecification mkSpecs      = new MortalKombatWinnerSpecification(roundsWon, roundsLost, mkCalculator);

            double pointsTaken = mkSpecs.Calculator.CalculatePointsTaken();

            pointsTaken.Should().Be(2);
        }