< Summary

Class:DCL.UpdateEventHandler
Assembly:UpdateEventHandler
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/UpdateEventHandler/UpdateEventHandler.cs
Covered lines:17
Uncovered lines:0
Coverable lines:17
Total lines:50
Line coverage:100% (17 of 17)
Covered branches:0
Total branches:0
Covered methods:5
Total methods:5
Method coverage:100% (5 of 5)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
UpdateEventHandler()0%110100%
AddListener(...)0%110100%
RemoveListener(...)0%220100%
Dispose()0%220100%
Initialize()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/UpdateEventHandler/UpdateEventHandler.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Linq;
 4using UnityEngine;
 5using UnityEngine.Assertions;
 6
 7namespace DCL
 8{
 9    public class UpdateEventHandler : IUpdateEventHandler
 10    {
 11        private UpdateDispatcher dispatcher;
 12        private const string UPDATE_DISPATCHER = "_UpdateDispatcher";
 13
 47814        public UpdateEventHandler ()
 15        {
 47816            var go = new GameObject();
 17   #if UNITY_EDITOR
 47818            go.name = UPDATE_DISPATCHER;
 19    #endif
 47820            dispatcher = go.AddComponent<UpdateDispatcher>();
 47821        }
 22
 23        public void AddListener( IUpdateEventHandler.EventType eventType, Action action )
 24        {
 217625            Assert.IsTrue( dispatcher != null, $"Dispatcher is null! Listener for event {eventType} couldn't be added!")
 217626            dispatcher.eventCollections[eventType].Add(action);
 217627        }
 28
 29        public void RemoveListener( IUpdateEventHandler.EventType eventType, Action action )
 30        {
 189931            if ( dispatcher == null )
 170032                return;
 33
 19934            dispatcher.eventCollections[eventType].Remove(action);
 19935        }
 36
 37        public void Dispose()
 38        {
 47839            if ( dispatcher != null )
 40            {
 47841                UnityEngine.Object.Destroy( dispatcher.gameObject );
 47842                dispatcher = null;
 43            }
 47844        }
 45
 46        public void Initialize()
 47        {
 47848        }
 49    }
 50}