예제 #1
0
        public void TopFiveNullTest()
        {
            string   filePath = @"..\..\TestFiles\ranklist.txt";
            IStorage storage  = new RankListStorage(filePath);

            var resultTopFive = storage.TopFive();

            var expectedCount = 0;
            var resultCount   = resultTopFive.Count;

            Assert.AreEqual(expectedCount, resultCount);
        }
예제 #2
0
        public void TopFiveHalfTest()
        {
            string   filePath = @"..\..\TestFiles\ranklist1.txt";
            IStorage storage  = new RankListStorage(filePath);
            var      topFive  = new List <RankListRecord>(5);

            topFive.Add(new RankListRecord(9, "super cheater"));
            topFive.Add(new RankListRecord(15, "someplayer with very long name"));
            topFive.Add(new RankListRecord(16, "Todor"));

            bool areEqual      = true;
            var  resultTopFive = storage.TopFive();

            for (int i = 0; i < resultTopFive.Count; i++)
            {
                if (resultTopFive[i].Name != topFive[i].Name || resultTopFive[i].Value != topFive[i].Value)
                {
                    areEqual = false;
                }
            }
            Assert.IsTrue(areEqual, "The result from TopFive() is incorrect");
        }