Пример #1
0
        public void GetUserScore_ReturnWinCounts()
        {
            Dictionary <IParticipant, ParticipantRecord> participants = ParticipantsBuilder.Create()
                                                                        .Add().Edit(r => AddWins(r, 3))
                                                                        .Add().Edit(r => AddWins(r, 5))
                                                                        .Add().Edit(r => AddWins(r, 4));

            var results = testObj.Evaluate(participants);

            Assert.AreEqual(3, results[0].score);
            Assert.AreEqual(5, results[1].score);
            Assert.AreEqual(4, results[2].score);
        }
Пример #2
0
        public void Evaluate_ReturnTiedWins()
        {
            Dictionary <IParticipant, ParticipantRecord> participants = ParticipantsBuilder.Create()
                                                                        .Add(1).Edit(r => AddWins(r))
                                                                        .Add(2).Edit(r => AddWins(r, 1, 3))
                                                                        .Add(3).Edit(r => AddWins(r, 1));

            var results = testObj.Evaluate(participants);

            Assert.AreEqual(0, results[0].score);
            Assert.AreEqual(2, results[1].score);
            Assert.AreEqual(1, results[2].score);
        }
Пример #3
0
        public void Evaluate_ReturnMembershipSeconds()
        {
            Dictionary <IParticipant, ParticipantRecord> participants = ParticipantsBuilder.Create()
                                                                        .Add(joinDate: DateTime.Today.AddDays(-3 * 7))
                                                                        .Add(joinDate: DateTime.Today.AddDays(-4 * 7))
                                                                        .Add(joinDate: DateTime.Today.AddDays(-5 * 7));

            var results = testObj.Evaluate(participants);

            Assert.AreEqual(3 * 7 * 24 * 60 * 60, results[0].score);
            Assert.AreEqual(4 * 7 * 24 * 60 * 60, results[1].score);
            Assert.AreEqual(5 * 7 * 24 * 60 * 60, results[2].score);
        }
Пример #4
0
        public void Evaluate_ReturnLeaguePointTotals()
        {
            Dictionary <IParticipant, ParticipantRecord> participants = ParticipantsBuilder.Create()
                                                                        .Add(leaguePoints: 10)
                                                                        .Add(leaguePoints: 20)
                                                                        .Add(leaguePoints: 30);

            var results = testObj.Evaluate(participants);

            Assert.AreEqual(10, results[0].score);
            Assert.AreEqual(20, results[1].score);
            Assert.AreEqual(30, results[2].score);
        }