Ejemplo n.º 1
0
        public void ChoooseConition_RandomNumberIsSix_WeatherIsWindy()
        {
            //Arrange
            Random  random   = new Random();
            Day     day      = new Day(random, new Player());
            Weather weather  = new Windy();
            string  expected = weather.condition;
            string  actual;

            //Act
            day.ChooseCondition();
            actual = weather.condition;

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Returns a specific Weather class based on the value of parameter iRange
    /// </summary>
    /// <param name="iRange">Specific choice of Weather Object</param>
    /// <returns>wTempWeather</returns>
    public Weather RandomWeatherRange(int iRange)
    {
        Weather wTempWeather = new Weather();

        switch (iRange)
        {
        case 0:     //Rain
            wTempWeather = new Sunny();
            return(wTempWeather);

        case 1:     //Sunny
            wTempWeather = new Rain();
            return(wTempWeather);

        case 2:     //Cloudy
            wTempWeather = new Cloudy();
            return(wTempWeather);

        case 3:     //Snow
            wTempWeather = new Snow();
            return(wTempWeather);

        case 4:     //Windy
            wTempWeather = new Windy();
            return(wTempWeather);

        case 5:     //Thunderstorm
            wTempWeather = new Thunderstorm();
            return(wTempWeather);

        case 6:     //Hail
            wTempWeather = new Hail();
            return(wTempWeather);

        case 7:     //Fog
            wTempWeather = new Fog();
            return(wTempWeather);

        case 8:     //HeatWave
            wTempWeather = new HeatWave();
            return(wTempWeather);
        }

        return(wTempWeather);
    }