< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WatchEntityShapeHandler(...)0%220100%
Dispose()0%110100%
OnShapeUpdated(...)0%330100%
OnShapeCleaned(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/DebugPlugins/Commons/ShapeWatcher/WatchEntityShapeHandler.cs

#LineLine coverage
 1using DCL.Models;
 2
 3namespace DCLPlugins.DebugPlugins.Commons
 4{
 5    public class WatchEntityShapeHandler
 6    {
 7        private readonly IDCLEntity entity;
 8        private readonly IShapeListener listener;
 9
 410        public WatchEntityShapeHandler(IDCLEntity entity, IShapeListener listener)
 11        {
 412            this.entity = entity;
 413            this.listener = listener;
 14
 415            if (entity.meshesInfo.currentShape != null)
 16            {
 217                OnShapeUpdated(entity);
 18            }
 19
 420            entity.OnMeshesInfoUpdated += OnShapeUpdated;
 421            entity.OnMeshesInfoCleaned += OnShapeCleaned;
 422        }
 23
 24        public void Dispose()
 25        {
 426            entity.OnMeshesInfoUpdated -= OnShapeUpdated;
 427            entity.OnMeshesInfoCleaned -= OnShapeCleaned;
 28
 429            listener.Dispose();
 430        }
 31
 32        private void OnShapeUpdated(IDCLEntity entity)
 33        {
 334            if (entity.meshesInfo.currentShape != null
 35                && entity.meshesInfo.meshRootGameObject != null)
 36            {
 237                listener.OnShapeUpdated(entity);
 38            }
 339        }
 40
 41        private void OnShapeCleaned(IDCLEntity entity)
 42        {
 143            listener.OnShapeCleaned(entity);
 144        }
 45    }
 46}