< 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:43
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 UnityEngine.Assertions;
 3
 4namespace AvatarSystem
 5{
 6    public class WearableLoaderFactory : IWearableLoaderFactory
 7    {
 8        public IWearableLoader GetWearableLoader(WearableItem item)
 9        {
 510            if (item == null)
 011                throw new Exception("Requested a WearableLoader with a null WearableItem");
 12
 513            if (item.data.category == WearableLiterals.Categories.BODY_SHAPE ||
 14                item.data.category == WearableLiterals.Categories.EYES ||
 15                item.data.category == WearableLiterals.Categories.EYEBROWS ||
 16                item.data.category == WearableLiterals.Categories.MOUTH)
 417                throw new Exception("Requested a WearableLoader with a bodyshape or facial feature");
 18
 119            return new WearableLoader(new WearableRetriever(), item);
 20        }
 21
 22        public IBodyshapeLoader GetBodyshapeLoader(WearableItem bodyshape, WearableItem eyes, WearableItem eyebrows,
 23            WearableItem mouth)
 24        {
 6925            if (bodyshape == null)
 026                throw new Exception("Requested a BodyshapeLoader with a null Bodyshape");
 27
 6928            if (eyes != null && eyes.data.category != WearableLiterals.Categories.EYES)
 229                throw new Exception($"Eye's category is not {WearableLiterals.Categories.EYES}");
 30
 6731            if (eyebrows != null && eyebrows.data.category != WearableLiterals.Categories.EYEBROWS)
 232                throw new Exception($"Eyebrows's category is not {WearableLiterals.Categories.EYEBROWS}");
 33
 6534            if (mouth != null && mouth.data.category != WearableLiterals.Categories.MOUTH)
 235                throw new Exception($"Mouth's category is not {WearableLiterals.Categories.MOUTH}");
 36
 6337            if (bodyshape.data.category != WearableLiterals.Categories.BODY_SHAPE)
 338                throw new Exception($"Bodyshape's category is not {WearableLiterals.Categories.BODY_SHAPE}");
 39
 6040            return new BodyShapeLoader(new RetrieverFactory(), bodyshape, eyes, eyebrows, mouth);
 41        }
 42    }
 43}