< Summary

Class:StickersFactory
Assembly:MainScripts
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/StickersController/StickersFactory.cs
Covered lines:9
Uncovered lines:0
Coverable lines:9
Total lines:36
Line coverage:100% (9 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
StickersFactory()0%110100%
EnsureDict()0%330100%
TryGet(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/StickersController/StickersFactory.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using UnityEngine;
 4
 5[CreateAssetMenu(fileName = "StickersFactory", menuName = "Variables/StickersFactory")]
 6public class StickersFactory : ScriptableObject
 7{
 8    [Serializable]
 9    public class StickerFactoryEntry
 10    {
 11        public string id;
 12        public GameObject stickerPrefab;
 13    }
 14
 115    [SerializeField] private List<StickerFactoryEntry> stickersList = new List<StickerFactoryEntry>();
 16    private Dictionary<string, GameObject> stickers;
 17
 18    private void EnsureDict()
 19    {
 5420        if (stickers != null)
 5321            return;
 22
 123        stickers = new Dictionary<string, GameObject>();
 1824        for (int i = 0; i < stickersList.Count; i++)
 25        {
 826            stickers.Add(stickersList[i].id, stickersList[i].stickerPrefab);
 27        }
 128    }
 29
 30    public bool TryGet(string id, out GameObject stickerPrefab)
 31    {
 5432        EnsureDict();
 33
 5434        return stickers.TryGetValue(id, out stickerPrefab);
 35    }
 36}