< Summary

Class:DCL.PropertyCylinder
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/PrimitiveMesh/AssetPromise_PrimitiveMesh_Model.cs
Covered lines:3
Uncovered lines:0
Coverable lines:3
Total lines:74
Line coverage:100% (3 of 3)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PropertyCylinder(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/PrimitiveMesh/AssetPromise_PrimitiveMesh_Model.cs

#LineLine coverage
 1using System.Collections.Generic;
 2
 3namespace DCL
 4{
 5    public readonly struct AssetPromise_PrimitiveMesh_Model
 6    {
 7        public enum PrimitiveType
 8        {
 9            Box = 0,
 10            Sphere = 1,
 11            Plane = 2,
 12            Cylinder = 3
 13        }
 14
 15        public readonly PrimitiveType type;
 16        public readonly object properties;
 17
 18        // Do not use constructor directly, use `Create` method instead
 19        private AssetPromise_PrimitiveMesh_Model(PrimitiveType type, object meshProperties)
 20        {
 21            this.type = type;
 22            this.properties = meshProperties;
 23        }
 24
 25        private static AssetPromise_PrimitiveMesh_Model Create<T>(PrimitiveType type, T properties) where T : struct
 26        {
 27            return new AssetPromise_PrimitiveMesh_Model(type, properties);
 28        }
 29
 30        public static AssetPromise_PrimitiveMesh_Model CreateBox(IList<float> uvs)
 31        {
 32            return Create(PrimitiveType.Box, new PropertyUvs(uvs));
 33        }
 34
 35        public static AssetPromise_PrimitiveMesh_Model CreatePlane(IList<float> uvs)
 36        {
 37            return Create(PrimitiveType.Plane, new PropertyUvs(uvs));
 38        }
 39
 40        public static AssetPromise_PrimitiveMesh_Model CreateSphere()
 41        {
 42            return Create(PrimitiveType.Sphere, new PropertyEmpty());
 43        }
 44
 45        public static AssetPromise_PrimitiveMesh_Model CreateCylinder(float radiusTop, float radiusBottom)
 46        {
 47            return Create(PrimitiveType.Cylinder, new PropertyCylinder(radiusTop, radiusBottom));
 48        }
 49    }
 50
 51    internal readonly struct PropertyEmpty { }
 52
 53    internal readonly struct PropertyUvs
 54    {
 55        public readonly IList<float> uvs;
 56
 57        public PropertyUvs(IList<float> uvs)
 58        {
 59            this.uvs = uvs;
 60        }
 61    }
 62
 63    internal readonly struct PropertyCylinder
 64    {
 65        public readonly float radiusTop;
 66        public readonly float radiusBottom;
 67
 68        public PropertyCylinder(float radiusTop, float radiusBottom)
 69        {
 570            this.radiusTop = radiusTop;
 571            this.radiusBottom = radiusBottom;
 572        }
 73    }
 74}