< 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
Covered methods:4
Total methods:4
Method coverage:100% (4 of 4)

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 : IInternalComponent
 8{
 9
 10    private readonly IInternalECSComponent<T> thisComponent;
 11    private readonly Func<T, bool> condition;
 12
 35113    public RemoveOnConditionHandler(Func<IInternalECSComponent<T>> componentGet, Func<T, bool> condition)
 14    {
 35115        this.thisComponent = componentGet();
 35116        this.condition = condition;
 35117    }
 18
 34919    public void OnComponentCreated(IParcelScene scene, IDCLEntity entity) { }
 20
 34921    public void OnComponentRemoved(IParcelScene scene, IDCLEntity entity) { }
 22
 23    public void OnComponentModelUpdated(IParcelScene scene, IDCLEntity entity, T model)
 24    {
 51325        if (condition(model))
 26        {
 8327            thisComponent.RemoveFor(scene, entity);
 28        }
 51329    }
 30}