public void Can_GetStationsByZip()
 {
     IGasStationRepository repos = new GasBuddyRepository();
     ((GasBuddyRepository)repos).Db = new SqlDatabase(_TEST_CONN_STR);
     List<IStation> stations = repos.GetStations("90275");
     Assert.IsNotNull(stations);
     Assert.IsTrue(stations.Count > 0);
 }
        public void Can_GetStations()
        {
            IGasStationRepository repos = new GasBuddyRepository();
            //List<IStation> stations = repos.GetStations("28.54644912706383", "-81.46342522071842");
            //List<IStation> stations = repos.GetStations("27.990726", "-82.575731");
            //34.048757,-118.466252
            List<IStation> stations = repos.GetStations("34.048757", "-118.466252");

            Assert.IsNotNull(stations);
            Assert.IsTrue(stations.Count > 0);
        }
 public JsonResult GetStations(string latitude, string longitude, string type, string zip)
 {
     List<IStation> stations = null;
     IGasStationRepository repos;
     switch (type)
     {
         case "mapquest":
             repos = new MapQuestRepository();
             if (!string.IsNullOrEmpty(latitude) && !string.IsNullOrEmpty(longitude))
             {
                 stations = repos.GetStations(latitude, longitude);
                 break;
             }
             if (!string.IsNullOrEmpty(zip))
             {
                 ((MapQuestRepository)repos).Db = new SqlDatabase(_DB_CONN_STR);
                 stations = repos.GetStations(zip);
                 break;
             }
             break;
         case "gaspricewatch":
             repos = new GasPriceWatchRepository();
             if (!string.IsNullOrEmpty(latitude) && !string.IsNullOrEmpty(longitude))
             {
                 stations = repos.GetStations(latitude, longitude);
                 break;
             }
             if (!string.IsNullOrEmpty(zip))
             {
                 ((GasPriceWatchRepository)repos).Db = new SqlDatabase(_DB_CONN_STR);
                 stations = repos.GetStations(zip);
                 break;
             }
             break;
         case "gasbuddy":
             repos = new GasBuddyRepository();
             if (!string.IsNullOrEmpty(latitude) && !string.IsNullOrEmpty(longitude))
             {
                 stations = repos.GetStations(latitude, longitude);
                 break;
             }
             if (!string.IsNullOrEmpty(zip))
             {
                 ((GasBuddyRepository)repos).Db = new SqlDatabase(_DB_CONN_STR);
                 stations = repos.GetStations(zip);
                 break;
             }
             break;
         case "msn":
             repos = new MSNAutosRepository(Server.MapPath("../tessdata"));
             if (!string.IsNullOrEmpty(latitude) && !string.IsNullOrEmpty(longitude))
             {
                 stations = repos.GetStations(latitude, longitude);
                 break;
             }
             if (!string.IsNullOrEmpty(zip))
             {
                 ((MSNAutosRepository)repos).Db = new SqlDatabase(_DB_CONN_STR);
                 stations = repos.GetStations(zip);
                 break;
             }
             break;
             break;
     }
     return Json(stations);
 }