/// <summary> /// Create a new instance of <see cref="WorldManager"/> /// </summary> public WorldManager(GameServer GameServerInstance) { if (GameServerInstance == null) throw new ArgumentNullException("GameServerInstance"); this.GameServerInstance = GameServerInstance; WeatherManager = new WeatherManager(this.GameServerInstance.Scheduler); }
public void WeatherManager_RegisterRegion_ReturnRegion() { var weatherMgr = new WeatherManager(new SimpleScheduler()); var region = FakeRegion(); weatherMgr.RegisterRegion(region); Assert.AreEqual(weatherMgr[1].Region, region); }
/// <summary> /// Create a new instance of <see cref="WorldManager"/> /// </summary> public WorldManager(GameServer GameServerInstance) { if (GameServerInstance == null) { throw new ArgumentNullException("GameServerInstance"); } this.GameServerInstance = GameServerInstance; WeatherManager = new WeatherManager(this.GameServerInstance.Scheduler); }
public void WeatherManager_UnRegisterRegion_ReturnNull() { var weatherMgr = new WeatherManager(new SimpleScheduler()); var region = FakeRegion(); weatherMgr.RegisterRegion(region); weatherMgr.UnRegisterRegion(region); Assert.IsNull(weatherMgr[1]); }
public void WeatherManager_ChangeWeatherNonExistentRegion_ReturnFalse() { var weatherMgr = new WeatherManager(new SimpleScheduler()); Assert.IsFalse(weatherMgr.ChangeWeather(1, weather => weather.Clear())); }
public void WeatherManager_GetNonExistentRegion_ReturnNull() { var weatherMgr = new WeatherManager(new SimpleScheduler()); Assert.IsNull(weatherMgr[1]); }
public void WeatherManager_ChangeWeatherRegionException_WeatherEqual() { var weatherMgr = new WeatherManager(new SimpleScheduler()); var region = FakeRegion(); weatherMgr.RegisterRegion(region); weatherMgr.ChangeWeather(1, weather => { weather.CreateWeather(65000, 300, 100, 16000, 0); throw new Exception(); }); Assert.AreEqual((65535 + 65000) / 300, weatherMgr[1].Duration / 1000); Assert.AreEqual(65000, weatherMgr[1].Width); }
public void WeatherManager_StopWeatherRegion_StartTime() { var weatherMgr = new WeatherManager(new SimpleScheduler()); var region = FakeRegion(); weatherMgr.RegisterRegion(region); weatherMgr.StartWeather(1); weatherMgr.StopWeather(1); Assert.AreEqual(0, weatherMgr[1].StartTime); }
public void WeatherManager_StopWeatherRegion_ReturnTrue() { var weatherMgr = new WeatherManager(new SimpleScheduler()); var region = FakeRegion(); weatherMgr.RegisterRegion(region); weatherMgr.StartWeather(1); Assert.IsTrue(weatherMgr.StopWeather(1)); }