コード例 #1
0
        public void Winners_Rating_Should_Increase(Rating winner, Rating loser)
        {
            // Arrange
            var trueSkillEngine    = new TwoPlayerTrueSkillEngine();
            var winnerInitialValue = new Rating(winner.Mean, winner.StandardDeviation);

            // Act
            trueSkillEngine.UpdateRatings(winner, loser);

            // Assert
            winner.Mean.Should().BeGreaterThan(winnerInitialValue.Mean, "The winner's mean should have increased due to winning a match");
            winner.StandardDeviation.Should().BeLessThan(winnerInitialValue.StandardDeviation, "The winner's standard deviation should have decreased due to having played more matches");
        }
コード例 #2
0
        public void Losers_Rating_Should_Decrease(Rating winner, Rating loser)
        {
            // Arrange
            var trueSkillEngine   = new TwoPlayerTrueSkillEngine();
            var loserInitialValue = new Rating(loser.Mean, loser.StandardDeviation);

            // Act
            trueSkillEngine.UpdateRatings(winner, loser);

            // Assert
            loser.Mean.Should().BeLessThan(loserInitialValue.Mean, "The loser's mean should have decreased due to losing a match.");
            loser.StandardDeviation.Should().BeLessThan(loserInitialValue.StandardDeviation, "The loser's standard deviation should have decreased due to having played more matches.");
        }
コード例 #3
0
        public void Should_Update_Both_Ratings(Rating winner, Rating loser)
        {
            // Arrange
            var trueSkillEngine    = new TwoPlayerTrueSkillEngine();
            var winnerInitialValue = new Rating(winner.Mean, winner.StandardDeviation);
            var loserInitialValue  = new Rating(loser.Mean, loser.StandardDeviation);

            // Act
            trueSkillEngine.UpdateRatings(winner, loser);

            // Assert
            winner.Should().NotBeEquivalentTo(winnerInitialValue, "Update ratings should update both the winner's mean and standard deviation");
            loser.Should().NotBeEquivalentTo(loserInitialValue, "Update ratings should update both the loser's mean and standard deviation");
        }