< Summary

Class:BoxShapeShould
Assembly:ParametrizedShapesTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/ParametrizedShapes/Tests/BoxShapeShould.cs
Covered lines:20
Uncovered lines:0
Coverable lines:20
Total lines:74
Line coverage:100% (20 of 20)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BeUpdatedCorrectly()0%220100%
UpdateUVsCorrectly()0%330100%
DefaultMissingValuesOnUpdate()0%440100%
BeReplacedCorrectlyWhenAnotherComponentIsAttached()0%330100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/ParametrizedShapes/Tests/BoxShapeShould.cs

#LineLine coverage
 1using System.Collections;
 2using DCL.Components;
 3using DCL.Helpers;
 4using DCL.Models;
 5using NUnit.Framework;
 6using UnityEngine;
 7using UnityEngine.TestTools;
 8
 9public class BoxShapeShould : IntegrationTestSuite_Legacy
 10{
 11    [UnityTest]
 12    public IEnumerator BeUpdatedCorrectly()
 13    {
 114        string entityId = "3";
 115        TestHelpers.InstantiateEntityWithShape(scene, entityId, DCL.Models.CLASS_ID.BOX_SHAPE, Vector3.zero);
 16
 117        var meshName = scene.entities[entityId].gameObject.GetComponentInChildren<MeshFilter>().mesh.name;
 118        Assert.AreEqual("DCL Box Instance", meshName);
 119        yield break;
 20    }
 21
 22    [UnityTest]
 23    public IEnumerator UpdateUVsCorrectly()
 24    {
 125        float[] uvs = new float[]
 26        {
 27            0, 0.75f, 0.25f, 0.75f, 0.25f, 1, 0, 1,
 28            0, 0.75f, 0.25f, 0.75f, 0.25f, 1, 0, 1,
 29            0, 0.75f, 0.25f, 0.75f, 0.25f, 1, 0, 1,
 30            0, 0.75f, 0.25f, 0.75f, 0.25f, 1, 0, 1,
 31            0, 0.75f, 0.25f, 0.75f, 0.25f, 1, 0, 1,
 32            0, 0.75f, 0.25f, 0.75f, 0.25f, 1, 0, 1
 33        };
 34
 35        IDCLEntity entity;
 36
 137        BoxShape box = TestHelpers.InstantiateEntityWithShape<BoxShape, BoxShape.Model>(
 38            scene,
 39            DCL.Models.CLASS_ID.BOX_SHAPE,
 40            Vector3.zero,
 41            out entity,
 42            new BoxShape.Model()
 43            {
 44                uvs = uvs
 45            });
 46
 147        yield return box.routine;
 48
 149        Assert.IsTrue(entity != null);
 150        Assert.IsTrue(box != null);
 151        Assert.IsTrue(box.currentMesh != null);
 152        CollectionAssert.AreEqual(Utils.FloatArrayToV2List(uvs), box.currentMesh.uv);
 153    }
 54
 55    [UnityTest]
 56    public IEnumerator DefaultMissingValuesOnUpdate()
 57    {
 158        var component =
 59            TestHelpers.SharedComponentCreate<BoxShape, BoxShape.Model>(scene, CLASS_ID.BOX_SHAPE);
 160        yield return component.routine;
 61
 162        Assert.IsFalse(component == null);
 63
 164        yield return TestHelpers.TestSharedComponentDefaultsOnUpdate<BoxShape.Model, BoxShape>(scene,
 65            CLASS_ID.BOX_SHAPE);
 166    }
 67
 68    [UnityTest]
 69    public IEnumerator BeReplacedCorrectlyWhenAnotherComponentIsAttached()
 70    {
 171        yield return TestHelpers.TestAttachedSharedComponentOfSameTypeIsReplaced<BoxShape.Model, BoxShape>(
 72            scene, CLASS_ID.BOX_SHAPE);
 173    }
 74}