< Summary

Class:DCL.AssetPromise_PrimitiveMesh
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/PrimitiveMesh/AssetPromise_PrimitiveMesh.cs
Covered lines:15
Uncovered lines:5
Coverable lines:20
Total lines:53
Line coverage:75% (15 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
AssetPromise_PrimitiveMesh()0%110100%
AssetPromise_PrimitiveMesh(...)0%110100%
OnAfterLoadOrReuse()0%110100%
OnBeforeLoadOrReuse()0%110100%
OnCancelLoading()0%2100%
OnLoad(...)0%3.473062.5%
AddToLibrary()0%2.062075%
GetId()0%110100%

File(s)

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

#LineLine coverage
 1using System;
 2using UnityEngine;
 3
 4namespace DCL
 5{
 6    public class AssetPromise_PrimitiveMesh : AssetPromise<Asset_PrimitiveMesh>
 7    {
 8        public PrimitiveMeshModel model;
 9
 110        private static readonly IPrimitiveMeshFactory primitiveMeshFactory = new PrimitiveMeshFactory();
 11
 412        public AssetPromise_PrimitiveMesh(PrimitiveMeshModel model)
 13        {
 414            this.model = model;
 415        }
 16
 4517        protected override void OnAfterLoadOrReuse() { }
 18
 4519        protected override void OnBeforeLoadOrReuse() { }
 20
 021        protected override void OnCancelLoading() { }
 22
 23        protected override void OnLoad(Action OnSuccess, Action<Exception> OnFail)
 24        {
 25            try
 26            {
 2927                Mesh currentMesh = primitiveMeshFactory.CreateMesh(model);
 2928                asset.mesh = currentMesh;
 2929                OnSuccess?.Invoke();
 2930            }
 031            catch (Exception e)
 32            {
 033                OnFail?.Invoke(e);
 034            }
 2935        }
 36
 37        protected override bool AddToLibrary()
 38        {
 2939            if (!library.Add(asset))
 40            {
 041                return false;
 42            }
 43
 2944            asset = library.Get(asset.id);
 2945            return true;
 46        }
 47
 48        public override object GetId()
 49        {
 24150            return model;
 51        }
 52    }
 53}