IHostingService GetManagedService(out AddressableAssetSettings settings) { var m = new HostingServicesManager(); settings = AddressableAssetSettings.Create(k_TestConfigFolder, k_TestConfigName, false, false); settings.HostingServicesManager = m; var group = settings.CreateGroup("testGroup", false, false, false, null); group.AddSchema <BundledAssetGroupSchema>(); settings.groups.Add(group); m.Initialize(settings); return(m.AddHostingService(m_Service.GetType(), "test")); }
public void OnAfterDeserializeShould_RestoreHostingServicesInstancesIfStillAlive() { m_Manager.Initialize(m_Settings); var svc = m_Manager.AddHostingService(typeof(TestHostingService), "test"); Assert.IsTrue(m_Manager.HostingServices.Contains(svc)); var generator = new ObjectIDGenerator(); var id = generator.GetId(svc, out bool firstTime); Assert.IsTrue(firstTime); m_Manager.OnBeforeSerialize(); var serializedData = Serialize(m_Manager); svc = null; m_Manager = null; m_Settings.HostingServicesManager = null; var newManager = new HostingServicesManager(); m_Settings.HostingServicesManager = newManager; newManager.Initialize(m_Settings); Deserialize(newManager, serializedData); newManager.OnAfterDeserialize(); Assert.IsNotEmpty(newManager.HostingServices); svc = newManager.HostingServices.FirstOrDefault(); Assert.NotNull(svc); var id2 = generator.GetId(svc, out firstTime); Assert.IsFalse(firstTime); Assert.AreEqual(id, id2); m_Manager = newManager; }
public void GlobalProfileVariablesShould_ContainPrivateIpAddressKey() { m_Manager.Initialize(m_Settings); var vars = m_Manager.GlobalProfileVariables; Assert.NotNull(vars); const string key = HostingServicesManager.KPrivateIpAddressKey; Assert.Contains(key, vars.Keys); Assert.NotNull(vars[key]); }