< Summary

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

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
 68013        public UpdateEventHandler ()
 14        {
 68015            var go = new GameObject("_UpdateDispatcher");
 68016            dispatcher = go.AddComponent<UpdateDispatcher>();
 68017        }
 18
 19        public void AddListener( IUpdateEventHandler.EventType eventType, Action action )
 20        {
 199121            Assert.IsTrue( dispatcher != null, "Dispatcher is null! This should never happen!");
 199122            dispatcher.eventCollections[eventType].Add(action);
 199123        }
 24
 25        public void RemoveListener( IUpdateEventHandler.EventType eventType, Action action )
 26        {
 200627            if ( dispatcher == null )
 1528                return;
 29
 199130            dispatcher.eventCollections[eventType].Remove(action);
 199131        }
 32
 33        public void Dispose()
 34        {
 68535            if ( dispatcher != null )
 36            {
 68037                UnityEngine.Object.Destroy( dispatcher.gameObject );
 68038                dispatcher = null;
 39            }
 68540        }
 41    }
 42}