< Summary

Class:DCL.ECS7.InternalComponents.InternalECSComponentsExtensions
Assembly:ECS7Plugin.InternalECSComponents.Interfaces
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Interfaces/InternalECSComponentsExtensions.cs
Covered lines:14
Uncovered lines:3
Coverable lines:17
Total lines:43
Line coverage:82.3% (14 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
RemoveRenderers(...)0%6.226081.82%
AddRenderers(...)0%6.046090%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Interfaces/InternalECSComponentsExtensions.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using DCL.Controllers;
 3using DCL.Models;
 4using UnityEngine;
 5
 6namespace DCL.ECS7.InternalComponents
 7{
 8    public static class InternalECSComponentsExtensions
 9    {
 10        public static void RemoveRenderers(this IInternalECSComponent<InternalTexturizable> texurizableInternalComponent
 11            IParcelScene scene, IDCLEntity entity, IList<Renderer> renderers)
 12        {
 1813            if (renderers == null)
 014                return;
 15
 1816            var model = texurizableInternalComponent.GetFor(scene, entity)?.model;
 17
 1818            if (model == null)
 019                return;
 20
 7221            for (int i = 0; i < renderers.Count; i++)
 22            {
 1823                model.renderers.Remove(renderers[i]);
 24            }
 1825            texurizableInternalComponent.PutFor(scene, entity, model);
 1826        }
 27
 28        public static void AddRenderers(this IInternalECSComponent<InternalTexturizable> texurizableInternalComponent,
 29            IParcelScene scene, IDCLEntity entity, IList<Renderer> renderers)
 30        {
 2631            if (renderers == null)
 032                return;
 33
 2634            var model = texurizableInternalComponent.GetFor(scene, entity)?.model ?? new InternalTexturizable();
 10435            for (int i = 0; i < renderers.Count; i++)
 36            {
 2637                model.renderers.Add(renderers[i]);
 38            }
 2639            model.dirty = true;
 2640            texurizableInternalComponent.PutFor(scene, entity, model);
 2641        }
 42    }
 43}