< Summary

Class:SettingsPanelDataStore
Assembly:SettingsPanelHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/Common/SettingsPanelDataStore.cs
Covered lines:4
Uncovered lines:9
Coverable lines:13
Total lines:38
Line coverage:30.7% (4 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SettingsPanelDataStore()0%110100%
Clear()0%2100%
SettingsPanelDataStore()0%110100%
Controls()0%110100%
TryGetController[T]()0%20400%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/SettingsPanelHUD/Scripts/Common/SettingsPanelDataStore.cs

#LineLine coverage
 1using DCL.SettingsCommon.SettingsControllers.BaseControllers;
 2
 3/// <summary>
 4/// Data Store that contains accessors to all the loaded settings controllers.
 5/// </summary>
 6public class SettingsPanelDataStore
 7{
 18    private static SettingsPanelDataStore instance = new SettingsPanelDataStore();
 349    public static SettingsPanelDataStore i { get => instance; }
 010    public static void Clear() => instance = new SettingsPanelDataStore();
 11
 12    /// <summary>
 13    /// Access to all the settings control controllers.
 14    /// </summary>
 115    public readonly Controls controls = new Controls();
 16
 17    public class Controls
 18    {
 119        public readonly BaseCollection<SettingsControlController> controlControllers = new BaseCollection<SettingsContro
 20
 21        public bool TryGetController<T>(out T controlController) where T : SettingsControlController
 22        {
 023            bool found = false;
 024            controlController = null;
 25
 026            foreach (SettingsControlController controller in controlControllers.Get())
 27            {
 028                if (controller is T)
 29                {
 030                    controlController = (T)controller;
 031                    return true;
 32                }
 33            }
 34
 035            return found;
 036        }
 37    }
 38}