< Summary

Class:Tests.SectionSceneContributorsSettingsShould
Assembly:BuilderProjectsPanelTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Tests/SectionSceneContributorsSettingsShould.cs
Covered lines:25
Uncovered lines:0
Coverable lines:25
Total lines:64
Line coverage:100% (25 of 25)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SetUp()0%110100%
TearDown()0%110100%
HavePrefabSetupCorrectly()0%110100%
ShowEmptyListCorrectly()0%110100%
UpdateContributorsCorrectly()0%110100%
TriggerUpdateContributorsCorrectly()0%110100%
GetVisibleChildrenAmount(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Tests/SectionSceneContributorsSettingsShould.cs

#LineLine coverage
 1using System.Linq;
 2using NUnit.Framework;
 3using UnityEngine;
 4
 5namespace Tests
 6{
 7    public class SectionSceneContributorsSettingsShould
 8    {
 9        private SectionSceneContributorsSettingsView view;
 10        private SectionSceneContributorsSettingsController controller;
 11
 12        [SetUp]
 13        public void SetUp()
 14        {
 415            var prefab = Resources.Load<SectionSceneContributorsSettingsView>(SectionSceneContributorsSettingsController
 416            view = Object.Instantiate(prefab);
 417            controller = new SectionSceneContributorsSettingsController(view, new FriendsController_Mock());
 418        }
 19
 20        [TearDown]
 821        public void TearDown() { controller.Dispose(); }
 22
 23        [Test]
 224        public void HavePrefabSetupCorrectly() { Assert.AreEqual(1, view.usersContainer.childCount); }
 25
 26        [Test]
 27        public void ShowEmptyListCorrectly()
 28        {
 129            view.SetEmptyList(true);
 30
 131            Assert.IsTrue(view.emptyListContainer.activeSelf);
 132            Assert.IsFalse(view.usersContainer.gameObject.activeSelf);
 133        }
 34
 35        [Test]
 36        public void UpdateContributorsCorrectly()
 37        {
 138            controller.UpdateContributors(new [] { "1", "2", "3" });
 39
 140            Assert.AreEqual(3, view.userElementViews.Count);
 141            Assert.AreEqual(3, GetVisibleChildrenAmount(view.usersContainer));
 42
 143            controller.UpdateContributors(new [] { "1", "2" });
 44
 145            Assert.AreEqual(2, view.userElementViews.Count);
 146            Assert.AreEqual(2, GetVisibleChildrenAmount(view.usersContainer));
 147        }
 48
 49        [Test]
 50        public void TriggerUpdateContributorsCorrectly()
 51        {
 152            controller.UpdateContributors(new [] { "1" });
 53
 154            bool triggered = false;
 255            void UpdateContributors(string sceneId, SceneContributorsUpdatePayload payload) { triggered = true; }
 56
 157            controller.OnRequestUpdateSceneContributors += UpdateContributors;
 158            view.userElementViews["1"].removeButton.onClick.Invoke();
 159            Assert.IsTrue(triggered);
 160        }
 61
 862        public int GetVisibleChildrenAmount(Transform parent) { return parent.Cast<Transform>().Count(child => child.gam
 63    }
 64}