< Summary

Class:Tests.AvatarVisibilityShould
Assembly:AvatarShapeTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Avatar/Tests/AvatarVisibilityTests.cs
Covered lines:17
Uncovered lines:0
Coverable lines:17
Total lines:53
Line coverage:100% (17 of 17)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SetUp()0%110100%
TearDown()0%110100%
DeactivateGameObjectsWhenVisibilityIsSetToFalse()0%110100%
ReactivateGameObjectsWhenVisibilityIsSetToTrue()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/Avatar/Tests/AvatarVisibilityTests.cs

#LineLine coverage
 1using AvatarShape_Tests;
 2using DCL;
 3using DCL.Helpers;
 4using NUnit.Framework;
 5using System.Collections;
 6using UnityEngine;
 7using UnityEngine.TestTools;
 8
 9namespace Tests
 10{
 11    public class AvatarVisibilityShould
 12    {
 13
 14        private GameObject parentGameObject;
 15        private AvatarVisibility visibility;
 16        private GameObject toggledGameObject;
 17
 18        [SetUp]
 19        protected void SetUp()
 20        {
 21            // Prepare both game objects
 222            parentGameObject = new GameObject();
 223            visibility = parentGameObject.AddComponent<AvatarVisibility>();
 224            toggledGameObject = new GameObject();
 225            toggledGameObject.transform.parent = parentGameObject.transform;
 226            visibility.gameObjectsToToggle = new[] { toggledGameObject };
 227        }
 28
 29        [TearDown]
 430        protected void TearDown() { Object.Destroy(parentGameObject); }
 31
 32        [Test]
 33        public void DeactivateGameObjectsWhenVisibilityIsSetToFalse()
 34        {
 35
 136            Assert.IsTrue(toggledGameObject.activeSelf);
 37
 138            visibility.SetVisibility("Caller1", true);
 139            visibility.SetVisibility("Caller2", false);
 140            Assert.IsFalse(toggledGameObject.activeSelf);
 141        }
 42
 43        [Test]
 44        public void ReactivateGameObjectsWhenVisibilityIsSetToTrue()
 45        {
 146            visibility.SetVisibility("Caller1", false);
 147            Assert.IsFalse(toggledGameObject.activeSelf);
 48
 149            visibility.SetVisibility("Caller1", true);
 150            Assert.True(toggledGameObject.activeSelf);
 151        }
 52    }
 53}