< Summary

Class:NftRarityBackgroundSO
Assembly:BackpackEditorHUDV2
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BackpackEditorHUDV2/AvatarSlot/NftRarityBackgroundSO.cs
Covered lines:5
Uncovered lines:0
Coverable lines:5
Total lines:20
Line coverage:100% (5 of 5)
Covered branches:0
Total branches:0
Covered methods:1
Total methods:1
Method coverage:100% (1 of 1)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetRarityImage(...)0%550100%

File(s)

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

#LineLine coverage
 1using UnityEngine;
 2
 3[CreateAssetMenu(fileName = "NftRarityBackground", menuName = "Variables/NftRarityBackground")]
 4public class NftRarityBackgroundSO : ScriptableObject
 5{
 6    private const string DEFAULT_RARITY = "default";
 7    [SerializeField] public SerializableKeyValuePair<string, Sprite>[] rarityIcons;
 8
 9    public Sprite GetRarityImage(string nftRarity)
 10    {
 15111        nftRarity = string.IsNullOrEmpty(nftRarity) ? DEFAULT_RARITY : nftRarity;
 185412        foreach (var icon in rarityIcons)
 13        {
 84914            if(icon.key == nftRarity)
 14615                return icon.value;
 16        }
 17
 518        return null;
 19    }
 20}

Methods/Properties

GetRarityImage(System.String)