Example #1
0
        public void AddSamePlayerToSameTeamTwice_ThrowsInvalidOperationException()
        {
            var playerIdentifier = new EloPlayerIdentifier();
            var player           = new EloPlayer(playerIdentifier, 1350);
            var team             = new EloTeam(player, true);

            Assert.Throws <InvalidOperationException>(() => team.AddPlayer(player));
        }
Example #2
0
        public void AddPlayerWithSameIdentifierToTwoTeams_ThrowsArgumentException()
        {
            var playerIdentifier = new EloPlayerIdentifier();
            var player1          = new EloPlayer(playerIdentifier, 1350);
            var player2          = new EloPlayer(playerIdentifier, 1330);

            Assert.Throws <ArgumentException>(() => new EloMatch(new[] { new EloTeam(player1, true), new EloTeam(player2, false) }));
        }
        public void PlayerWithSameIdentifierAndRating_AssertEquality()
        {
            var identifier = new EloPlayerIdentifier(Guid.NewGuid());
            var rating     = new EloRating(1200);
            var player1    = new EloPlayer(identifier, rating);
            var player2    = new EloPlayer(identifier, rating);

            Assert.AreEqual(player1, player2);
            Assert.IsTrue(player1 == player2);
            Assert.IsTrue(player1.Equals(player2));
        }
        public void TwoTeamsWithSamePlayers_AssertEquality()
        {
            var playerIdentifier = new EloPlayerIdentifier();
            var rating           = new EloRating(1200);
            var player1          = new EloPlayer(playerIdentifier, rating);
            var player2          = new EloPlayer(playerIdentifier, rating);
            var teamIdentifier   = new EloTeamIdentifier();
            var team1            = new EloTeam(teamIdentifier, player1, true);
            var team2            = new EloTeam(teamIdentifier, player2, false);

            Assert.AreEqual(team1, team2);
            Assert.IsTrue(team1 == team2);
            Assert.IsTrue(team1.Equals(team2));
        }