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 DetermineIdToLoad_IfOnlineMismatchesCache_ReturnsRemoteId() { 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> { "newHash", "hash" }); Assert.AreEqual(k_RemoteLocationId, loadedId); loadedId = contentCatalogOp.DetermineIdToLoad(location, new List <object> { "newHash", string.Empty }); Assert.AreEqual(k_RemoteLocationId, 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)); }