< Summary

Class:AvatarSystem.WearableLoaderFactory
Assembly:AvatarSystem
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/AvatarSystem/Loader/WearableLoaderFactory.cs
Covered lines:14
Uncovered lines:2
Coverable lines:16
Total lines:44
Line coverage:87.5% (14 of 16)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetWearableLoader(...)0%6.296080%
GetBodyshapeLoader(...)0%9.069090.91%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/AvatarSystem/Loader/WearableLoaderFactory.cs

#LineLine coverage
 1using System;
 2using DCL;
 3using UnityEngine.Assertions;
 4
 5namespace AvatarSystem
 6{
 7    public class WearableLoaderFactory : IWearableLoaderFactory
 8    {
 9        public IWearableLoader GetWearableLoader(WearableItem item)
 10        {
 511            if (item == null)
 012                throw new Exception("Requested a WearableLoader with a null WearableItem");
 13
 514            if (item.data.category == WearableLiterals.Categories.BODY_SHAPE ||
 15                item.data.category == WearableLiterals.Categories.EYES ||
 16                item.data.category == WearableLiterals.Categories.EYEBROWS ||
 17                item.data.category == WearableLiterals.Categories.MOUTH)
 418                throw new Exception("Requested a WearableLoader with a bodyshape or facial feature");
 19
 120            return new WearableLoader(new WearableRetriever(), item);
 21        }
 22
 23        public IBodyshapeLoader GetBodyshapeLoader(WearableItem bodyshape, WearableItem eyes, WearableItem eyebrows,
 24            WearableItem mouth)
 25        {
 1026            if (bodyshape == null)
 027                throw new Exception("Requested a BodyshapeLoader with a null Bodyshape");
 28
 1029            if (eyes != null && eyes.data.category != WearableLiterals.Categories.EYES)
 230                throw new Exception($"Eye's category is not {WearableLiterals.Categories.EYES}");
 31
 832            if (eyebrows != null && eyebrows.data.category != WearableLiterals.Categories.EYEBROWS)
 233                throw new Exception($"Eyebrows's category is not {WearableLiterals.Categories.EYEBROWS}");
 34
 635            if (mouth != null && mouth.data.category != WearableLiterals.Categories.MOUTH)
 236                throw new Exception($"Mouth's category is not {WearableLiterals.Categories.MOUTH}");
 37
 438            if (bodyshape.data.category != WearableLiterals.Categories.BODY_SHAPE)
 339                throw new Exception($"Bodyshape's category is not {WearableLiterals.Categories.BODY_SHAPE}");
 40
 141            return new BodyShapeLoader(new RetrieverFactory(), bodyshape, eyes, eyebrows, mouth);
 42        }
 43    }
 44}