< Summary

Class:WearableLiterals
Assembly:AvatarAssets
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarAssets/WearableLiterals.cs
Covered lines:7
Uncovered lines:1
Coverable lines:8
Total lines:96
Line coverage:87.5% (7 of 8)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Categories()0%110100%
DefaultWearables()0%110100%
GetDefaultWearables()0%110100%
GetDefaultWearables(...)0%220100%
GetDefaultWearable(...)0%2.152066.67%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Models/AvatarAssets/WearableLiterals.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Collections.ObjectModel;
 3using System.Linq;
 4
 5public static class WearableLiterals
 6{
 7    public static class Misc
 8    {
 9        public const string HEAD = "head";
 10    }
 11
 12    public static class Tags
 13    {
 14        public const string BASE_WEARABLE = "base-wearable";
 15        public const string EXCLUSIVE = "exclusive";
 16    }
 17
 18    public static class Categories
 19    {
 120        public static readonly ReadOnlyCollection<string> REQUIRED_CATEGORIES = new ReadOnlyCollection<string>(new List<
 21
 22        public const string BODY_SHAPE = "body_shape";
 23        public const string UPPER_BODY = "upper_body";
 24        public const string LOWER_BODY = "lower_body";
 25        public const string FEET = "feet";
 26        public const string EYES = "eyes";
 27        public const string EYEBROWS = "eyebrows";
 28        public const string MOUTH = "mouth";
 29        public const string FACIAL = "facial";
 30        public const string HAIR = "hair";
 31        public const string SKIN = "skin";
 32        public const string FACIAL_HAIR = "facial_hair";
 33
 34        //TODO: Implement an IReadOnlyCollection for HashSet to make them immutable
 135        public static readonly HashSet<string> ALL  = new HashSet<string>
 36        {
 37            UPPER_BODY,
 38            LOWER_BODY,
 39            EYEBROWS,
 40            FACIAL,
 41            MOUTH,
 42            FEET,
 43            EYES,
 44            SKIN
 45        };
 46    }
 47
 48    public static class BodyShapes
 49    {
 50        public const string FEMALE = "urn:decentraland:off-chain:base-avatars:BaseFemale";
 51        public const string MALE = "urn:decentraland:off-chain:base-avatars:BaseMale";
 52    }
 53
 54    public static class ItemRarity
 55    {
 56        public const string RARE = "rare";
 57        public const string EPIC = "epic";
 58        public const string LEGENDARY = "legendary";
 59        public const string MYTHIC = "mythic";
 60        public const string UNIQUE = "unique";
 61    }
 62
 63    public static class DefaultWearables
 64    {
 165        public static readonly IReadOnlyDictionary<(string, string), string> defaultWearables = new Dictionary<(string, 
 66        {
 67            { (BodyShapes.MALE, Categories.EYES), "urn:decentraland:off-chain:base-avatars:eyes_00" },
 68            { (BodyShapes.MALE, Categories.EYEBROWS), "urn:decentraland:off-chain:base-avatars:eyebrows_00" },
 69            { (BodyShapes.MALE, Categories.MOUTH), "urn:decentraland:off-chain:base-avatars:mouth_00" },
 70            { (BodyShapes.MALE, Categories.HAIR), "urn:decentraland:off-chain:base-avatars:casual_hair_01" },
 71            { (BodyShapes.MALE, Categories.FACIAL), "urn:decentraland:off-chain:base-avatars:beard" },
 72            { (BodyShapes.MALE, Categories.UPPER_BODY), "urn:decentraland:off-chain:base-avatars:green_hoodie" },
 73            { (BodyShapes.MALE, Categories.LOWER_BODY), "urn:decentraland:off-chain:base-avatars:brown_pants" },
 74            { (BodyShapes.MALE, Categories.FEET), "urn:decentraland:off-chain:base-avatars:sneakers" },
 75
 76            { (BodyShapes.FEMALE, Categories.EYES), "urn:decentraland:off-chain:base-avatars:f_eyes_00" },
 77            { (BodyShapes.FEMALE, Categories.EYEBROWS), "urn:decentraland:off-chain:base-avatars:f_eyebrows_00" },
 78            { (BodyShapes.FEMALE, Categories.MOUTH), "urn:decentraland:off-chain:base-avatars:f_mouth_00" },
 79            { (BodyShapes.FEMALE, Categories.HAIR), "urn:decentraland:off-chain:base-avatars:standard_hair" },
 80            { (BodyShapes.FEMALE, Categories.UPPER_BODY), "urn:decentraland:off-chain:base-avatars:f_sweater" },
 81            { (BodyShapes.FEMALE, Categories.LOWER_BODY), "urn:decentraland:off-chain:base-avatars:f_jeans" },
 82            { (BodyShapes.FEMALE, Categories.FEET), "urn:decentraland:off-chain:base-avatars:bun_shoes" },
 83        };
 84
 185        public static string[] GetDefaultWearables() => defaultWearables.Values.Distinct().ToArray();
 115586        public static string[] GetDefaultWearables(string bodyShapeId) => defaultWearables.Where(x => x.Key.Item1 == bod
 87
 88        public static string GetDefaultWearable(string bodyShapeId, string category)
 89        {
 57090            if (!defaultWearables.ContainsKey((bodyShapeId, category)))
 091                return null;
 92
 57093            return defaultWearables[(bodyShapeId, category)];
 94        }
 95    }
 96}