< 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
 412        public WatchSceneHandler(IParcelScene scene, ISceneListener sceneListener)
 13        {
 414            this.scene = scene;
 415            this.sceneListener = sceneListener;
 16
 417            scene.OnEntityAdded += SceneOnOnEntityAdded;
 418            scene.OnEntityRemoved += SceneOnOnEntityRemoved;
 19
 420            if (scene.entities?.Values != null)
 21            {
 422                foreach (IDCLEntity entity in scene.entities.Values)
 23                {
 124                    sceneListener.OnEntityAdded(entity);
 25                }
 26            }
 427        }
 28
 29        public void Dispose()
 30        {
 431            scene.OnEntityAdded -= SceneOnOnEntityAdded;
 432            scene.OnEntityRemoved -= SceneOnOnEntityRemoved;
 33
 434            sceneListener.Dispose();
 435        }
 36
 37        private void SceneOnOnEntityAdded(IDCLEntity entity)
 38        {
 139            sceneListener.OnEntityAdded(entity);
 140        }
 41
 42        private void SceneOnOnEntityRemoved(IDCLEntity entity)
 43        {
 144            sceneListener.OnEntityRemoved(entity);
 145        }
 46    }
 47}