< Summary

Class:DCL.UpdateEventHandler
Assembly:UpdateController
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/UpdateEventHandler/UpdateEventHandler.cs
Covered lines:14
Uncovered lines:0
Coverable lines:14
Total lines:40
Line coverage:100% (14 of 14)
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%110100%
Dispose()0%220100%

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
 70113        public UpdateEventHandler ()
 14        {
 70115            var go = new GameObject("_UpdateDispatcher");
 70116            dispatcher = go.AddComponent<UpdateDispatcher>();
 70117        }
 18
 19        public void AddListener( IUpdateEventHandler.EventType eventType, Action action )
 20        {
 2121            Assert.IsTrue( dispatcher != null, "Dispatcher is null! This should never happen!");
 2122            dispatcher.eventCollections[eventType].Add(action);
 2123        }
 24
 25        public void RemoveListener( IUpdateEventHandler.EventType eventType, Action action )
 26        {
 2127            Assert.IsTrue( dispatcher != null, "Dispatcher is null! This should never happen!");
 2128            dispatcher.eventCollections[eventType].Remove(action);
 2129        }
 30
 31        public void Dispose()
 32        {
 72733            if ( dispatcher != null )
 34            {
 70135                UnityEngine.Object.Destroy( dispatcher.gameObject );
 70136                dispatcher = null;
 37            }
 72738        }
 39    }
 40}