Esempio n. 1
0
 private static void ValidateLocationParameter(NextBusParameters parameters)
 {
     if (string.IsNullOrWhiteSpace(parameters.Location))
     {
         throw new ArgumentException("Need a to or from location");
     }
 }
Esempio n. 2
0
        private void GetStopIdAndRouteCode(NextBusParameters parameters, out string stopId, out string routeCode, out Locations location)
        {
            var locationStr = parameters.Location.ToUpper();

            location = Enum.Parse <Locations>(locationStr);
            switch (location)
            {
            case Locations.WORK:
                stopId    = _configuration[WorkStopIdKey];
                routeCode = _configuration[WorkRouteCodeKey];
                break;

            case Locations.HOME:
                stopId    = _configuration[HomeStopIdKey];
                routeCode = _configuration[HomeRouteCodeKey];
                break;

            default:
                throw new Exception("Location not supported");
            }
        }