< Summary

Class:DCL.Backpack.BackpackEditorHUDModel
Assembly:BackpackEditorHUDV2
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BackpackEditorHUDV2/BackpackEditorHUDModel.cs
Covered lines:9
Uncovered lines:9
Coverable lines:18
Total lines:55
Line coverage:50% (9 of 18)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:3
Method coverage:66.6% (2 of 3)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BackpackEditorHUDModel()0%110100%
ToAvatarModel(...)0%550100%
Update(...)0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BackpackEditorHUDV2/BackpackEditorHUDModel.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3using UnityEngine;
 4
 5namespace DCL.Backpack
 6{
 7    public record BackpackEditorHUDModel
 8    {
 439        public WearableItem bodyShape = new() { id = "NOT_LOADED" };
 4310        public Dictionary<string, WearableItem> wearables = new ();
 11        public Color hairColor;
 12        public Color skinColor;
 13        public Color eyesColor;
 4314        public HashSet<string> forceRender = new ();
 15
 16        public AvatarModel ToAvatarModel(Dictionary<string, string> extendedWearableUrns = null)
 17        {
 18            List<string> wearables;
 19
 5820            if (extendedWearableUrns != null)
 21            {
 2622                wearables = new List<string>();
 23
 14424                foreach (string w in this.wearables.Keys)
 4625                    wearables.Add(extendedWearableUrns.TryGetValue(w, out string extendedUrn)
 26                        ? extendedUrn : w);
 27            }
 28            else
 3229                wearables = this.wearables.Keys.ToList();
 30
 5831            return new AvatarModel
 32            {
 33                bodyShape = bodyShape.id,
 34                wearables = wearables,
 35                hairColor = hairColor,
 36                skinColor = skinColor,
 37                eyeColor = eyesColor,
 38                forceRender = new HashSet<string>(forceRender)
 39            };
 40        }
 41
 42        public void Update(BackpackEditorHUDModel newModel)
 43        {
 044            wearables.Clear();
 045            foreach (var wearable in newModel.wearables)
 046                wearables.Add(wearable.Key, wearable.Value);
 47
 048            bodyShape = newModel.bodyShape;
 049            hairColor = newModel.hairColor;
 050            skinColor = newModel.skinColor;
 051            eyesColor = newModel.eyesColor;
 052            forceRender = new HashSet<string>(newModel.forceRender);
 053        }
 54    }
 55}