public void DetermineIdToLoad_IfNoDependencies_ReturnsMainId() { var contentCatalogOp = new ContentCatalogProvider.InternalOp(); var loadedId = contentCatalogOp.DetermineIdToLoad(m_SimpleLocation, null); Assert.AreEqual(k_LocationId, loadedId); }
public void DetermineIdToLoad_IfOfflineAndNoCache_ReturnsMainId() { var contentCatalogOp = new ContentCatalogProvider.InternalOp(); var loadedId = contentCatalogOp.DetermineIdToLoad(m_SimpleLocation, new List <object> { string.Empty, string.Empty }); Assert.AreEqual(k_LocationId, loadedId); }
public void BundledCatalog_WhenRequestingRemoteCatalog_CanLoadCatalogFromBundle_ReturnsExpectedResult(string internalId, bool result) { var loc = new ResourceLocationBase(internalId, internalId, typeof(ContentCatalogProvider).FullName, typeof(IResourceLocator)); ProviderOperation <Object> op = new ProviderOperation <Object>(); op.Init(m_Addressables.ResourceManager, null, loc, new AsyncOperationHandle <IList <AsyncOperationHandle> >()); ProvideHandle handle = new ProvideHandle(m_Addressables.ResourceManager, op); bool loadCatalogFromLocalBundle = new ContentCatalogProvider.InternalOp().CanLoadCatalogFromBundle(internalId, handle.Location); Assert.AreEqual(result, loadCatalogFromLocalBundle); }
public void BundledCatalog_WhenRequestingLocalCatalog_CanLoadCatalogFromBundle_ReturnsTrue() { string internalId = Path.Combine(Addressables.RuntimePath, m_RuntimeCatalogFilename); var loc = new ResourceLocationBase(internalId, internalId, typeof(ContentCatalogProvider).FullName, typeof(IResourceLocator)); ProviderOperation <Object> op = new ProviderOperation <Object>(); op.Init(m_Addressables.ResourceManager, null, loc, new AsyncOperationHandle <IList <AsyncOperationHandle> >()); ProvideHandle handle = new ProvideHandle(m_Addressables.ResourceManager, op); bool loadCatalogFromLocalBundle = new ContentCatalogProvider.InternalOp().CanLoadCatalogFromBundle(internalId, handle.Location); Assert.IsTrue(loadCatalogFromLocalBundle); }
public void DetermineIdToLoad_IfOnlineMatchesCache_ReturnsCacheId() { var contentCatalogOp = new ContentCatalogProvider.InternalOp(); IResourceLocation[] dependencies = new IResourceLocation[(int)ContentCatalogProvider.DependencyHashIndex.Count]; dependencies[(int)ContentCatalogProvider.DependencyHashIndex.Remote] = new ResourceLocationBase(string.Empty, k_RemoteLocationId, typeof(ContentCatalogProvider).FullName); dependencies[(int)ContentCatalogProvider.DependencyHashIndex.Cache] = new ResourceLocationBase(string.Empty, k_CacheLocationId, typeof(ContentCatalogProvider).FullName); var location = new ResourceLocationBase(k_LocationName, k_LocationId, typeof(ContentCatalogProvider).FullName, dependencies); var loadedId = contentCatalogOp.DetermineIdToLoad(location, new List <object> { "hash", "hash" }); Assert.AreEqual(k_CacheLocationId, loadedId); }
public void DetermineIdToLoad_IfDisableContentCatalogUpdateTrue_ForcesCachedIdWhenLocalHashExists() { var contentCatalogOp = new ContentCatalogProvider.InternalOp(); IResourceLocation[] dependencies = new IResourceLocation[(int)ContentCatalogProvider.DependencyHashIndex.Count]; dependencies[(int)ContentCatalogProvider.DependencyHashIndex.Remote] = new ResourceLocationBase(string.Empty, k_RemoteLocationId, typeof(ContentCatalogProvider).FullName, typeof(object)); dependencies[(int)ContentCatalogProvider.DependencyHashIndex.Cache] = new ResourceLocationBase(string.Empty, k_CacheLocationId, typeof(ContentCatalogProvider).FullName, typeof(object)); var location = new ResourceLocationBase(k_LocationName, k_LocationId, typeof(ContentCatalogProvider).FullName, typeof(object), dependencies); var loadedId = contentCatalogOp.DetermineIdToLoad(location, new List <object> { "hash", "local" }, true); Assert.AreEqual(k_CacheLocationId, loadedId); }
public void DetermineIdToLoad_SetsLocalHash_WhenDisableContentCatalogIsTrue_AndNoLocalHashExists() { var contentCatalogOp = new ContentCatalogProvider.InternalOp(); IResourceLocation[] dependencies = new IResourceLocation[(int)ContentCatalogProvider.DependencyHashIndex.Count]; dependencies[(int)ContentCatalogProvider.DependencyHashIndex.Remote] = new ResourceLocationBase(string.Empty, k_RemoteLocationId, typeof(ContentCatalogProvider).FullName, typeof(object)); dependencies[(int)ContentCatalogProvider.DependencyHashIndex.Cache] = new ResourceLocationBase(string.Empty, k_CacheLocationId, typeof(ContentCatalogProvider).FullName, typeof(object)); var location = new ResourceLocationBase(k_LocationName, k_LocationId, typeof(ContentCatalogProvider).FullName, typeof(object), dependencies); Assert.IsTrue(string.IsNullOrEmpty(contentCatalogOp.m_LocalHashValue)); var loadedId = contentCatalogOp.DetermineIdToLoad(location, new List <object> { "hash", "" }, true); Assert.IsFalse(string.IsNullOrEmpty(contentCatalogOp.m_LocalHashValue)); }