public void WeatherSystemTest() { int CloudCover = 0; DateTime date = new DateTime(2009, 10, 12); date = date.AddHours(7); Coordinate coord = new Coordinate(64, 10); double sunshine = WeatherSystem.CalculateSunShineWm2(date, 5, coord, CloudCover); //Assert.IsTrue(sunshine > 510 && sunshine < 560, // string.Format("Sunshine Wm2 is {0}; should be between 510 and 560", sunshine)); double sunheightDeg = WeatherSystem.CalculateSunHeightDeg(date, coord); //Assert.IsTrue(sunheightDeg > 32 && sunheightDeg < 34, // string.Format("Sunheight Deg is {0}; should be around 33.8", sunheightDeg)); double sunDeclination = WeatherSystem.CalculateSunDeclination(date, coord); //Assert.IsTrue(sunDeclination > 4.1 && sunDeclination < 4.4, // string.Format("Sun Declination Deg is {0}; should be 4.3", sunDeclination)); DateTimeFromTo SunRiseSet = WeatherSystem.CalculateSunRiseSunSet(date, coord); if (SunRiseSet.ToTime != null && SunRiseSet.FromTime != null) { GameManager.Instance.Log.LogDebug(string.Format( "WeatherSystemTest() : Sunrise at {0}, Sunset at {1}", SunRiseSet.FromTime, SunRiseSet.ToTime)); } GameManager.Instance.CreateGame(new Player(), "test game"); GameManager.Instance.Game.GameStartTime = date; GameManager.Instance.Game.UpperLeftCorner = new Coordinate(70, -10); GameManager.Instance.Game.LowerRightCorner = new Coordinate(40, 10); GameManager.Instance.GameData.InitMainWeatherSystems( GameConstants.WeatherSystemTypes.Rough, GameConstants.WeatherSystemSeasonTypes.Autumn); GameManager.Instance.GameData.RecreateWeatherDataFromMain(); WeatherSystem weather = GameManager.Instance.GameData.GetWeather(new Coordinate(60, 5)); Assert.IsNotNull(weather, "Weather should not be null."); var weather50degN = WeatherSystem.CreateRandomWeatherSystem(GameConstants.WeatherSystemTypes.Fine, GameConstants.WeatherSystemSeasonTypes.Autumn, 50); var weather70degN = WeatherSystem.CreateRandomWeatherSystem(GameConstants.WeatherSystemTypes.Fine, GameConstants.WeatherSystemSeasonTypes.Autumn, 70); GameManager.Instance.Game.GameCurrentTime = new DateTime(2030, 9, 29, 13, 20, 0); GameManager.Instance.GameData.RecreateWeatherDataFromMain(); var wsystem1 = GameManager.Instance.GameData.GetWeather(new Coordinate(60, 5)); Assert.IsTrue(wsystem1.TotalLightPercent > 75, "There should be daylight."); GameManager.Instance.Game.GameCurrentTime = new DateTime(2030, 9, 29, 22, 20, 0); GameManager.Instance.GameData.RecreateWeatherDataFromMain(); var wsystem2 = GameManager.Instance.GameData.GetWeather(new Coordinate(60, 5)); Assert.IsTrue(wsystem2.TotalLightPercent < 10, "There should be night."); }