< Summary

Class:DCL.Components.AvatarAttachComponent
Assembly:AvatarAttach
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/AvatarAttach/AvatarAttachComponent.cs
Covered lines:10
Uncovered lines:8
Coverable lines:18
Total lines:63
Line coverage:55.5% (10 of 18)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetDataFromJSON(...)0%110100%
get_scene()0%2100%
get_entity()0%2100%
get_componentName()0%110100%
AvatarAttachComponent()0%110100%
Initialize(...)0%110100%
IsValid()0%2100%
GetModel()0%2100%
GetClassId()0%110100%
UpdateFromJSON(...)0%110100%
UpdateFromModel(...)0%2100%
DCL-Components-IComponent-ApplyChanges()0%6200%
RaiseOnAppliedChanges()0%2100%
GetTransform()0%110100%
Cleanup()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/AvatarAttach/AvatarAttachComponent.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using DCL.Controllers;
 4using DCL.Helpers;
 5using DCL.Models;
 6using UnityEngine;
 7
 8namespace DCL.Components
 9{
 10    public class AvatarAttachComponent : IEntityComponent
 11    {
 12        [Serializable]
 13        public class Model : BaseModel
 14        {
 15            public string avatarId = null;
 16            public int anchorPointId = 0;
 17
 18            public override BaseModel GetDataFromJSON(string json)
 19            {
 120                return Utils.SafeFromJson<Model>(json);
 21            }
 22        }
 23
 024        IParcelScene IComponent.scene => handler.scene;
 025        IDCLEntity IEntityComponent.entity => handler.entity;
 26
 427        string IComponent.componentName => "AvatarAttach";
 28
 129        private readonly AvatarAttachHandler handler = new AvatarAttachHandler();
 30
 31        void IEntityComponent.Initialize(IParcelScene scene, IDCLEntity entity)
 32        {
 133            handler.Initialize(scene, entity, Environment.i.platform.updateEventHandler);
 134        }
 35
 036        bool IComponent.IsValid() => true;
 37
 038        BaseModel IComponent.GetModel() => handler.model;
 39
 140        int IComponent.GetClassId() => (int)CLASS_ID_COMPONENT.AVATAR_ATTACH;
 41
 42        void IComponent.UpdateFromJSON(string json)
 43        {
 144            handler.OnModelUpdated(json);
 145        }
 46
 47        void IComponent.UpdateFromModel(BaseModel newModel)
 48        {
 049            handler.OnModelUpdated(newModel as Model);
 050        }
 51
 52        IEnumerator IComponent.ApplyChanges(BaseModel newModel)
 53        {
 054            yield break;
 55        }
 56
 057        void IComponent.RaiseOnAppliedChanges() { }
 58
 259        Transform IMonoBehaviour.GetTransform() => null;
 60
 161        void ICleanable.Cleanup() => handler.Dispose();
 62    }
 63}