コード例 #1
0
        public void CacheMemory_Methods_SetCache_And_GetCache_For_Stations()
        {
            //Arrange
            var fetchFile = new WeatherObservation();

            //Act (USE DEBUGER TO BE SURE THE SECOND GETPARAMETERS FETCHES FROM CACHE)
            var firstFetch = fetchFile.GetWeatherStations(4);
            var secondFetche = fetchFile.GetWeatherStations(4);

            //Assert
            Assert.AreSame(firstFetch, secondFetche);
        }
コード例 #2
0
        public void Method_GetWeatherStations_IntergrationTest_ExpectedException()
        {
            //Arrange
            var injectionWeather = new FakeHttpRequestException();
            var injectionCache = new FakeCachedData();
            var weatherObj = new WeatherObservation(injectionWeather);

            //Assert (unexpected parameter value)
            weatherObj.GetWeatherStations(500);
        }
コード例 #3
0
        public void Method_GetWeatherStations_TDD()
        {
            //Arrange
            var injectionWeather = new FakeWeatherObservationRepository();
            var injectionCache = new FakeCachedData();
            var weatherObj = new WeatherObservation(injectionWeather);

            IEnumerable<WeatherStationModel> stations = null;

            Assert.IsNull(stations);

            //Act
            stations = weatherObj.GetWeatherStations(5);

            //Assert
            Assert.IsNotNull(stations);
        }
コード例 #4
0
        public void Method_GetweatherStations_Count()
        {
            //Arrange
            var injectionWeather = new FakeWeatherObservationRepository();
            var injectionCache = new FakeCachedData();
            var weatherObj = new WeatherObservation(injectionWeather);

            var listOfStations = weatherObj.GetWeatherStations(4);

            //Act
            var numberOfStations = listOfStations.Count();

            //Assert
            Assert.AreEqual(numberOfStations, 11);
            //Fails
            //Assert.AreEqual(numberOfStations, 100);
        }
コード例 #5
0
 static Graph()
 {
     WeatherObj = new WeatherObservation();
     Stations = WeatherObj.GetWeatherStations(4);
 }
コード例 #6
0
        /// <summary>
        /// ButtonSearch_click will search for weather station 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ButtonSearch_OnClick(object sender, EventArgs e)
        {
            //Get weatherStation (taking windkey as parameter)
            var weatherObj = new WeatherObservation();
            var stations = weatherObj.GetWeatherStations(4);

            //input from user. weather station search
            var seachBoxValue = TextBoxSearchWindTemp.Text;

            try
            {
                _stationKey = (int)(from station in stations where station.Name.Contains(seachBoxValue) select station.Id).First();
            }
            catch
            {
                PlaceHolderError.Visible = true;
                LabelError.Text = "Ingen mätstation med det namnet hittades";
            }
        }