public void Arrange()
 {
     _weatherRepo = new WeatherRepository();
     _weather     = new Weather
     {
         WeatherID       = 1,
         IsPrecipitating = true,
         WindSpeed       = 30,
         WindDirection   = WindDirection.East,
         Temperature     = 55,
         WeatherDate     = DateTimeOffset.Now
     };
     _weatherRepo.AddWeatherItemToList(_weather);
 }
예제 #2
0
        //TODO: Need to break some items into separate methods
        public void Run()
        {
            _weatherRepo = new WeatherRepository();
            var weatherList = _weatherRepo.GetWeatherList();

            Console.WriteLine("Enter the Weather ID:");
            string input = Console.ReadLine();
            var    id    = int.Parse(input);

            Console.WriteLine("Enter the current temp (°f):"); //-- alt + 0176
            var temp = float.Parse(Console.ReadLine());

            Console.WriteLine("Enter the Wind Speed (mph):");
            var speed = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter the Wind Direction:\n" +
                              "1. N \n2. NE \n3. E \n4. SE \n5. S \n6. SW \n7. W \n8. NW");
            var           direction     = int.Parse(Console.ReadLine());
            WindDirection windDirection = (WindDirection)direction;

            bool isWet;

            Console.WriteLine("Is it precipitating? (y/n)");
            var isWetString = Console.ReadLine();

            if (isWetString == "y")
            {
                isWet = true;
            }
            else
            {
                isWet = false;
            }

            var weather = new Weather
            {
                WeatherID       = id,
                WeatherDate     = DateTimeOffset.Now,
                WindSpeed       = speed,
                WindDirection   = windDirection,
                IsPrecipitating = isWet,
                Temperature     = temp
            };

            _weatherRepo.AddWeatherItemToList(weather);
        }