< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetWearableLoader(...)0%42600%
GetBodyShapeLoader(...)0%90900%

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        {
 011            if (item == null)
 012                throw new Exception("Requested a WearableLoader with a null WearableItem");
 13
 014            if (item.data.category
 15                is WearableLiterals.Categories.BODY_SHAPE
 16                or WearableLiterals.Categories.EYES
 17                or WearableLiterals.Categories.EYEBROWS
 18                or WearableLiterals.Categories.MOUTH)
 019                throw new Exception("Requested a WearableLoader with a bodyshape or facial feature");
 20
 021            return new WearableLoader(new WearableRetriever(), item);
 22        }
 23
 24        public IBodyshapeLoader GetBodyShapeLoader(BodyWearables bodyWearables)
 25        {
 026            if (bodyWearables.BodyShape == null)
 027                throw new Exception("Requested a BodyshapeLoader with a null Bodyshape");
 28
 029            if (bodyWearables.BodyShape.data.category != WearableLiterals.Categories.BODY_SHAPE)
 030                throw new Exception($"Bodyshape's category is not {WearableLiterals.Categories.BODY_SHAPE}");
 31
 032            if (bodyWearables.Eyes != null && bodyWearables.Eyes.data.category != WearableLiterals.Categories.EYES)
 033                throw new Exception($"Eye's category is not {WearableLiterals.Categories.EYES}");
 34
 035            if (bodyWearables.Eyebrows != null && bodyWearables.Eyebrows.data.category != WearableLiterals.Categories.EY
 036                throw new Exception($"Eyebrows's category is not {WearableLiterals.Categories.EYEBROWS}");
 37
 038            if (bodyWearables.Mouth != null && bodyWearables.Mouth.data.category != WearableLiterals.Categories.MOUTH)
 039                throw new Exception($"Mouth's category is not {WearableLiterals.Categories.MOUTH}");
 40
 041            return new BodyShapeLoader(new RetrieverFactory(), bodyWearables);
 42        }
 43    }
 44}