< Summary

Class:RemoveOnConditionHandler[T]
Assembly:ECS7Plugin.InternalECSComponents
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Handlers/RemoveOnConditionHandler.cs
Covered lines:9
Uncovered lines:0
Coverable lines:9
Total lines:30
Line coverage:100% (9 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
RemoveOnConditionHandler(...)0%110100%
OnComponentCreated(...)0%110100%
OnComponentRemoved(...)0%110100%
OnComponentModelUpdated(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/InternalECSComponents/Handlers/RemoveOnConditionHandler.cs

#LineLine coverage
 1using System;
 2using DCL.Controllers;
 3using DCL.ECS7.InternalComponents;
 4using DCL.ECSRuntime;
 5using DCL.Models;
 6
 7public class RemoveOnConditionHandler<T> : IECSComponentHandler<T> where T : InternalComponent
 8{
 9
 10    private readonly IInternalECSComponent<T> thisComponent;
 11    private readonly Func<T, bool> condition;
 12
 12313    public RemoveOnConditionHandler(Func<IInternalECSComponent<T>> componentGet, Func<T, bool> condition)
 14    {
 12315        this.thisComponent = componentGet();
 12316        this.condition = condition;
 12317    }
 18
 12119    public void OnComponentCreated(IParcelScene scene, IDCLEntity entity) { }
 20
 6621    public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity) { }
 22
 23    public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, T model)
 24    {
 17525        if (condition(model))
 26        {
 827            thisComponent.RemoveFor(scene, entity);
 28        }
 17529    }
 30}