< Summary

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

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
 55113        public UpdateEventHandler ()
 14        {
 55115            var go = new GameObject("_UpdateDispatcher");
 55116            dispatcher = go.AddComponent<UpdateDispatcher>();
 55117        }
 18
 19        public void AddListener( IUpdateEventHandler.EventType eventType, Action action )
 20        {
 218621            Assert.IsTrue( dispatcher != null, $"Dispatcher is null! Listener for event {eventType} couldn't be added!")
 218622            dispatcher.eventCollections[eventType].Add(action);
 218623        }
 24
 25        public void RemoveListener( IUpdateEventHandler.EventType eventType, Action action )
 26        {
 217927            if ( dispatcher == null )
 197228                return;
 29
 20730            dispatcher.eventCollections[eventType].Remove(action);
 20731        }
 32
 33        public void Dispose()
 34        {
 55135            if ( dispatcher != null )
 36            {
 55137                UnityEngine.Object.Destroy( dispatcher.gameObject );
 55138                dispatcher = null;
 39            }
 55140        }
 41
 42        public void Initialize()
 43        {
 55144        }
 45    }
 46}