< Summary

Class:ScenesRefreshHelper
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/ScenesController/ScenesRefreshHelper.cs
Covered lines:13
Uncovered lines:9
Coverable lines:22
Total lines:54
Line coverage:59% (13 of 22)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Set(...)0%330100%
WasDeployedScene(...)0%220100%
WasProjectScene(...)0%220100%
IsSceneUpdate(...)0%220100%
IsSceneDeployStatusChanged(...)0%440100%
GetOldDictionary(...)0%12300%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/HUD/ProjectsPanelHUD/Scripts/ScenesController/ScenesRefreshHelper.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using DCL.Builder;
 3
 4internal class ScenesRefreshHelper
 5{
 06    public Dictionary<string, ISceneCardView> oldDeployedScenes { get; private set; }
 07    public Dictionary<string, ISceneCardView> oldProjectsScenes { get; private set; }
 08    public bool isOldDeployedScenesEmpty { get; private set; }
 09    public bool isOldProjectScenesEmpty { get; private set; }
 10
 11    public void Set(Dictionary<string, ISceneCardView> oldDeployedScenes,
 12        Dictionary<string, ISceneCardView> oldProjectsScenes)
 13    {
 514        this.oldDeployedScenes = oldDeployedScenes;
 515        this.oldProjectsScenes = oldProjectsScenes;
 16
 517        isOldDeployedScenesEmpty = oldDeployedScenes == null || oldDeployedScenes.Count == 0;
 518        isOldProjectScenesEmpty = oldProjectsScenes == null || oldProjectsScenes.Count == 0;
 519    }
 20
 21    public bool WasDeployedScene(ISceneData sceneData)
 22    {
 1823        if (isOldDeployedScenesEmpty)
 124            return false;
 25
 1726        return oldDeployedScenes.ContainsKey(sceneData.id);
 27    }
 28
 29    public bool WasProjectScene(ISceneData sceneData)
 30    {
 931        if (isOldProjectScenesEmpty)
 632            return false;
 33
 334        return oldProjectsScenes.ContainsKey(sceneData.id);
 35    }
 36
 737    public bool IsSceneUpdate(ISceneData sceneData) { return WasDeployedScene(sceneData) || WasProjectScene(sceneData); 
 38
 939    public bool IsSceneDeployStatusChanged(ISceneData sceneData) { return (!sceneData.isDeployed && WasDeployedScene(sce
 40
 41    public Dictionary<string, ISceneCardView> GetOldDictionary(ISceneData sceneData)
 42    {
 043        if (WasDeployedScene(sceneData))
 44        {
 045            return oldDeployedScenes;
 46        }
 047        if (WasProjectScene(sceneData))
 48        {
 049            return oldProjectsScenes;
 50        }
 51
 052        return null;
 53    }
 54}