< Summary

Class:DCL.UUIDComponent
Assembly:DCL.Components.Events
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/UUIDEventComponentsPlugin/UUIDComponent/UUIDComponent.cs
Covered lines:8
Uncovered lines:5
Coverable lines:13
Total lines:57
Line coverage:61.5% (8 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetDataFromJSON(...)0%2100%
GetClassIdFromType()0%6.116085.71%
ApplyChanges(...)0%6200%
GetClassId()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/UUIDEventComponentsPlugin/UUIDComponent/UUIDComponent.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using DCL.Components;
 4using DCL.Helpers;
 5using DCL.Models;
 6
 7namespace DCL
 8{
 9    public class UUIDComponent : BaseComponent
 10    {
 11        [Serializable]
 12        public class Model : BaseModel
 13        {
 14            public string type;
 15            public string uuid;
 16
 17            public override BaseModel GetDataFromJSON(string json)
 18            {
 019                return Utils.SafeFromJson<Model>(json);
 20            }
 21
 22            public CLASS_ID_COMPONENT GetClassIdFromType()
 23            {
 7024                switch (type)
 25                {
 26                    case OnPointerDown.NAME:
 2127                        return CLASS_ID_COMPONENT.UUID_ON_DOWN;
 28                    case OnPointerUp.NAME:
 929                        return CLASS_ID_COMPONENT.UUID_ON_UP;
 30                    case OnClick.NAME:
 2131                        return CLASS_ID_COMPONENT.UUID_ON_CLICK;
 32                    case OnPointerHoverEnter.NAME:
 1333                        return CLASS_ID_COMPONENT.UUID_ON_HOVER_ENTER;
 34                    case OnPointerHoverExit.NAME:
 635                        return CLASS_ID_COMPONENT.UUID_ON_HOVER_EXIT;
 36                }
 37
 038                return CLASS_ID_COMPONENT.UUID_CALLBACK;
 39            }
 40        }
 41
 3842        public override string componentName => uuidComponentName;
 43
 3044        protected virtual string uuidComponentName { get; }
 45
 46        public override IEnumerator ApplyChanges(BaseModel newModel)
 47        {
 048            this.model = newModel ?? new Model();
 049            return null;
 50        }
 51
 52        public override int GetClassId()
 53        {
 054            return (int) CLASS_ID_COMPONENT.UUID_CALLBACK;
 55        }
 56    }
 57}