Example #1
0
        public void Run(Competitor competitorA, Competitor competitorB)
        {
            RunSequence = ++sequence;

            var ranks = this.matchStrategy.GenerateResult(this.winsToClinchMatch, competitorA, competitorB);

            Winner = ranks.First(x => x.Value == 1).Key;
            Loser = ranks.First(x => x.Value == 2).Key;
        }
        public void RunTest_Rating()
        {
            Competitor competitorA = new Competitor() { Name = "A", TheoreticalRating = 50 };
            Competitor competitorB = new Competitor() { Name = "B", TheoreticalRating = 60 };

            Match match = new Match(new NonRandomMs(), 1);
            match.Run(competitorA, competitorB);

            Assert.AreEqual(competitorB, match.Winner);
            Assert.AreEqual(competitorA, match.Loser);
        }
        public void RunTest_SimpleRandomMatchStrategy()
        {
            Competitor competitorA = new Competitor() { Name = "A", TheoreticalRating = 60 };
            Competitor competitorB = new Competitor() { Name = "B", TheoreticalRating = 40 };

            Match match = new Match(new SimpleRandomMs(), 1);

            int wins = 0;
            for (int i = 0; i < 100; i++)
            {
                match.Run(competitorA, competitorB);
                if (match.Winner.Name == "A")
                    wins++;
            }
        }