Ejemplo n.º 1
0
        public void ReadDrawTest()
        {
            string file           = Resources.CFile;
            var    personLookup   = new CFile.PersonLookup((key, name, nationalityCode) => PersonLookup(key, name, nationalityCode));
            var    competitorList = new PersonCompetitorList();

            using (var reader = new StringReader(file))
                competitorList.Competitors = new List <CompetitorBase>(CFile.ReadPersonCompetitors(reader, personLookup));

            IList <Race> draw;

            using (var reader = new StringReader(file))
                draw = CFile.ReadDraw(reader, competitorList.Competitors).ToList();

            Assert.AreEqual(21, draw.Count);
            Assert.IsTrue(draw.Select(r => r.Heat).Distinct().SequenceEqual(Enumerable.Range(1, 11)));
            Assert.IsTrue(draw.All(r => r.Competitor != null));
            Assert.AreEqual(0, draw[9].Lane);
            Assert.AreEqual(1, draw[10].Color);
        }