Ejemplo n.º 1
0
        public void Show25WithMax30Pos4()
        {
            int?       position           = 4;
            const uint recordsToShow      = 25;
            const uint maxRecordsToReport = 30;

            DedimaniaRanking[] rankings = GetRankings(maxRecordsToReport, "scordo", position);
            SortedList <uint, DedimaniaRanking> rankingsToShow = DedimaniaUIPlugin.GetRankingsToShow(rankings, "scordo", recordsToShow, maxRecordsToReport);

            Assert.AreEqual(recordsToShow, (uint)rankingsToShow.Count);
            Assert.AreEqual("scordo", rankingsToShow[(uint)position.Value].Login);

            for (uint i = 1; i < maxRecordsToReport; i++)
            {
                if (i < 15)
                {
                    Assert.IsTrue(rankingsToShow.ContainsKey(i));
                }
                else if (i < 20)
                {
                    Assert.IsFalse(rankingsToShow.ContainsKey(i));
                }
                else
                {
                    Assert.IsTrue(rankingsToShow.ContainsKey(i));
                }
            }
        }
Ejemplo n.º 2
0
        public void Show3WithMax0()
        {
            DedimaniaRanking[] rankings = GetRankings(0, "scordo", null);
            SortedList <uint, DedimaniaRanking> rankingsToShow = DedimaniaUIPlugin.GetRankingsToShow(rankings, "scordo", 3, 30);

            Assert.AreEqual(3, rankingsToShow.Count);
        }
Ejemplo n.º 3
0
        public void Show3WithMax30Pos3()
        {
            const uint maxRecordsToReport = 30;

            DedimaniaRanking[] rankings = GetRankings(maxRecordsToReport, "scordo", 3);
            SortedList <uint, DedimaniaRanking> rankingsToShow = DedimaniaUIPlugin.GetRankingsToShow(rankings, "scordo", 3, 30);

            Assert.AreEqual(3, rankingsToShow.Count);
            Assert.AreEqual("scordo1", rankingsToShow[1].Login);
            Assert.AreEqual("scordo2", rankingsToShow[2].Login);
            Assert.AreEqual("scordo", rankingsToShow[3].Login);
        }
Ejemplo n.º 4
0
        public void Show8WithMax30()
        {
            const uint recordsToShow      = 8;
            const uint maxRecordsToReport = 30;

            DedimaniaRanking[] rankings = GetRankings(maxRecordsToReport, "scordo", null);
            SortedList <uint, DedimaniaRanking> rankingsToShow = DedimaniaUIPlugin.GetRankingsToShow(rankings, "scordo", recordsToShow, maxRecordsToReport);

            Assert.AreEqual(recordsToShow, (uint)rankingsToShow.Count);

            for (uint i = 1; i < maxRecordsToReport; i++)
            {
                if (i < 7 || i > 28)
                {
                    Assert.IsTrue(rankingsToShow.ContainsKey(i));
                }
                else
                {
                    Assert.IsFalse(rankingsToShow.ContainsKey(i));
                }
            }
        }