< Summary

Class:DCLPlugins.DebugPlugins.Commons.WatchSceneHandler
Assembly:DebugPlugins_Commons_SceneWatcher
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/Commons/SceneWatcher/WatchSceneHandler.cs
Covered lines:17
Uncovered lines:0
Coverable lines:17
Total lines:47
Line coverage:100% (17 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WatchSceneHandler(...)0%550100%
Dispose()0%110100%
SceneOnOnEntityAdded(...)0%110100%
SceneOnOnEntityRemoved(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/Commons/SceneWatcher/WatchSceneHandler.cs

#LineLine coverage
 1using System;
 2using DCL.Controllers;
 3using DCL.Models;
 4
 5namespace DCLPlugins.DebugPlugins.Commons
 6{
 7    public class WatchSceneHandler : IDisposable
 8    {
 9        private readonly IParcelScene scene;
 10        private readonly ISceneListener sceneListener;
 11
 1412        public WatchSceneHandler(IParcelScene scene, ISceneListener sceneListener)
 13        {
 1414            this.scene = scene;
 1415            this.sceneListener = sceneListener;
 16
 1417            scene.OnEntityAdded += SceneOnOnEntityAdded;
 1418            scene.OnEntityRemoved += SceneOnOnEntityRemoved;
 19
 1420            if (scene.entities?.Values != null)
 21            {
 2422                foreach (IDCLEntity entity in scene.entities.Values)
 23                {
 124                    sceneListener.OnEntityAdded(entity);
 25                }
 26            }
 1427        }
 28
 29        public void Dispose()
 30        {
 1431            scene.OnEntityAdded -= SceneOnOnEntityAdded;
 1432            scene.OnEntityRemoved -= SceneOnOnEntityRemoved;
 33
 1434            sceneListener.Dispose();
 1435        }
 36
 37        private void SceneOnOnEntityAdded(IDCLEntity entity)
 38        {
 1739            sceneListener.OnEntityAdded(entity);
 1740        }
 41
 42        private void SceneOnOnEntityRemoved(IDCLEntity entity)
 43        {
 644            sceneListener.OnEntityRemoved(entity);
 645        }
 46    }
 47}