< Summary

Class:SectionsHandler
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Scripts/Handlers/SectionsHandler.cs
Covered lines:28
Uncovered lines:6
Coverable lines:34
Total lines:80
Line coverage:82.3% (28 of 34)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SectionsHandler(...)0%110100%
Dispose()0%110100%
OnSectionShow(...)0%5.685070%
OnSectionHide(...)0%5.685070%
OnSelectScene(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Scripts/Handlers/SectionsHandler.cs

#LineLine coverage
 1using System;
 2
 3internal class SectionsHandler : IDisposable
 4{
 5    private readonly ISectionsController sectionsController;
 6    private readonly IScenesViewController scenesViewController;
 7    private readonly SearchBarView searchBarView;
 8    private readonly ILandController landController;
 9
 1610    public SectionsHandler(ISectionsController sectionsController, IScenesViewController scenesViewController, ILandCont
 11    {
 1612        this.sectionsController = sectionsController;
 1613        this.scenesViewController = scenesViewController;
 1614        this.searchBarView = searchBarView;
 1615        this.landController = landController;
 16
 1617        sectionsController.OnSectionShow += OnSectionShow;
 1618        sectionsController.OnSectionHide += OnSectionHide;
 1619        scenesViewController.OnSceneSelected += OnSelectScene;
 1620    }
 21
 22    public void Dispose()
 23    {
 1624        sectionsController.OnSectionShow -= OnSectionShow;
 1625        sectionsController.OnSectionHide -= OnSectionHide;
 1626        scenesViewController.OnSceneSelected -= OnSelectScene;
 1627    }
 28
 29    void OnSectionShow(SectionBase sectionBase)
 30    {
 231        if (sectionBase is IDeployedSceneListener deployedSceneListener)
 32        {
 233            scenesViewController.AddListener(deployedSceneListener);
 34        }
 35
 236        if (sectionBase is IProjectSceneListener projectSceneListener)
 37        {
 038            scenesViewController.AddListener(projectSceneListener);
 39        }
 40
 241        if (sectionBase is ISelectSceneListener selectSceneListener)
 42        {
 043            scenesViewController.AddListener(selectSceneListener);
 44        }
 45
 246        if (sectionBase is ILandsListener landsListener)
 47        {
 048            landController.AddListener(landsListener);
 49        }
 50
 251        searchBarView.SetSearchBar(sectionBase.searchHandler, sectionBase.searchBarConfig);
 252    }
 53
 54    void OnSectionHide(SectionBase sectionBase)
 55    {
 156        if (sectionBase is IDeployedSceneListener deployedSceneListener)
 57        {
 158            scenesViewController.RemoveListener(deployedSceneListener);
 59        }
 60
 161        if (sectionBase is IProjectSceneListener projectSceneListener)
 62        {
 063            scenesViewController.RemoveListener(projectSceneListener);
 64        }
 65
 166        if (sectionBase is ISelectSceneListener selectSceneListener)
 67        {
 068            scenesViewController.RemoveListener(selectSceneListener);
 69        }
 70
 171        if (sectionBase is ILandsListener landsListener)
 72        {
 073            landController.RemoveListener(landsListener);
 74        }
 75
 176        searchBarView.SetSearchBar(null, null);
 177    }
 78
 479    void OnSelectScene(ISceneCardView sceneCardView) { sectionsController.OpenSection(SectionId.SETTINGS_PROJECT_GENERAL
 80}