Ejemplo n.º 1
0
        public void ShouldParse(string str, double expected)
        {
            // TODO: Complete Should Parse
            //ARRANGE
            var tacoParser = new TacoParser();
            //ACT
            TacoBells actual = (TacoBells)tacoParser.Parse(str);

            //ASSERT
            Assert.Equal(expected, actual.lat);
        }
Ejemplo n.º 2
0
        public void ShouldFailParse(string str)
        {
            // TODO: Complete Should Fail Parse
            //ARRANGE
            var tacoParser = new TacoParser();
            //ACT
            TacoBells actual = (TacoBells)tacoParser.Parse(str);

            //ASSERT
            Assert.Null(actual);
        }
Ejemplo n.º 3
0
        public ITrackable Parse(string line)
        {
            logger.LogInfo("Begin parsing");
            if (line == null)
            {
                return(null);
            }


            //DONE// Take your line and use line.Split(',') to split it up into an array of strings, separated by the char ','
            var cells = line.Split(',');

            if (cells.Length < 3)
            {
                logger.LogError("Incorrect Input Info");
                return(null);
            }

            var lat   = double.Parse(cells[0]);
            var longi = double.Parse(cells[1]);
            var name  = cells[2];

            var p = new Point()
            {
                Latitude  = lat,
                Longitude = longi
            };

            var tacoBell = new TacoBells();

            tacoBell.lat   = lat;
            tacoBell.longi = longi;
            tacoBell.Name  = name;

            return(tacoBell);
        }