Ejemplo n.º 1
0
        public void ListHorses_EmptyFilePath()
        {
            string inputFilePath = "";
            ContextRacingAnimalOperator contextFileParser = new ContextRacingAnimalOperator(new JSONInputFileParser());
            //Empty list expected
            List <RacingHorse> expected_horsesSortedAscending = new List <RacingHorse>();

            var horsesSortedAscending = contextFileParser.returnListOfHorsesPriceAscending(inputFilePath);

            CollectionAssert.AreEqual(expected_horsesSortedAscending, horsesSortedAscending, new RacingHorseListComparer());
        }
Ejemplo n.º 2
0
        public void ListHorses_JSON_ValidCase1()
        {
            string inputFilePath = "FeedData/Wolferhampton_Race1.json";
            ContextRacingAnimalOperator contextFileParser = new ContextRacingAnimalOperator(new JSONInputFileParser());
            List <RacingHorse>          expected_horsesSortedAscending = new List <RacingHorse> {
                new RacingHorse {
                    Id = "2", Name = "Toolatetodelegate", Price = 4.4
                },
                new RacingHorse {
                    Id = "1", Name = "Fikhaar", Price = 10.0
                }
            };

            var horsesSortedAscending = contextFileParser.returnListOfHorsesPriceAscending(inputFilePath);

            CollectionAssert.AreEqual(expected_horsesSortedAscending, horsesSortedAscending, new RacingHorseListComparer());
        }
Ejemplo n.º 3
0
        public void ListHorses_XML_ValidCase1()
        {
            string inputFilePath = "FeedData/Caulfield_Race1.xml";
            ContextRacingAnimalOperator contextFileParser = new ContextRacingAnimalOperator(new XMLInputFileParser());
            List <RacingHorse>          expected_horsesSortedAscending = new List <RacingHorse> {
                new RacingHorse {
                    Id = "872699", Name = "Advancing", Price = 4.2
                },
                new RacingHorse {
                    Id = "872442", Name = "Coronel", Price = 12.0
                }
            };

            var horsesSortedAscending = contextFileParser.returnListOfHorsesPriceAscending(inputFilePath);

            CollectionAssert.AreEqual(expected_horsesSortedAscending, horsesSortedAscending, new RacingHorseListComparer());
        }