< Summary

Class:DCL.DataStore_ECS7_Extensions
Assembly:DataStore
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/Extensions/DataStore_ECS7_Extensions.cs
Covered lines:21
Uncovered lines:5
Coverable lines:26
Total lines:68
Line coverage:80.7% (21 of 26)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AddPointerEvent(...)0%220100%
RemovePointerEvent(...)0%12300%
AddPendingResource(...)0%220100%
RemovePendingResource(...)0%220100%
AddShapeReady(...)0%110100%
RemoveShapeReady(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/Extensions/DataStore_ECS7_Extensions.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using DCLPlugins.UUIDEventComponentsPlugin.UUIDComponent.Interfaces;
 3using UnityEngine;
 4
 5namespace DCL
 6{
 7    public static class DataStore_ECS7_Extensions
 8    {
 9        public static void AddPointerEvent( this DataStore_ECS7 self, long entityId, IPointerInputEvent pointerEvent )
 10        {
 811            if (self.entityEvents.TryGetValue(entityId, out List<IPointerInputEvent> events))
 12            {
 613               events.Add(pointerEvent);
 614            }
 15            else
 16            {
 217                events = new List<IPointerInputEvent>()
 18                {
 19                    pointerEvent
 20                };
 221                self.entityEvents.Add(entityId,events);
 22            }
 223        }
 24
 25        public static void RemovePointerEvent( this DataStore_ECS7 self, long entityId, IPointerInputEvent pointerEvent 
 26        {
 027            if (self.entityEvents.TryGetValue(entityId, out List<IPointerInputEvent> events))
 28            {
 029                events.Remove(pointerEvent);
 030                if (events.Count == 0)
 031                    self.entityEvents.Remove(entityId);
 32            }
 033        }
 34
 35        public static void AddPendingResource( this DataStore_ECS7 self, string sceneId, object model )
 36        {
 7737            if (self.pendingSceneResources.TryGetValue(sceneId, out BaseRefCountedCollection<object> pendingResoruces))
 38            {
 6939                pendingResoruces.IncreaseRefCount(model);
 6940            }
 41            else
 42            {
 843                BaseRefCountedCollection<object>  newCountedCollection = new BaseRefCountedCollection<object>();
 844                newCountedCollection.IncreaseRefCount(model);
 845                self.pendingSceneResources.Add(sceneId,newCountedCollection);
 46            }
 847        }
 48
 49        public static void RemovePendingResource( this DataStore_ECS7 self, string sceneId, object model)
 50        {
 14851            if (self.pendingSceneResources.TryGetValue(sceneId, out BaseRefCountedCollection<object> pendingResoruces))
 52            {
 14753                pendingResoruces.DecreaseRefCount(model);
 54            }
 14855        }
 56
 57        public static void AddShapeReady( this DataStore_ECS7 self, long entityId, GameObject gameObject )
 58        {
 6059            self.shapesReady.AddOrSet(entityId,gameObject);
 6060        }
 61
 62        public static void RemoveShapeReady( this DataStore_ECS7 self, long entityId)
 63        {
 6764            if(self.shapesReady.ContainsKey(entityId))
 5165                self.shapesReady.Remove(entityId);
 6766        }
 67    }
 68}