< Summary

Class:Tests.SceneContextMenuShould
Assembly:BuilderProjectsPanelTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Tests/SceneContextMenuShould.cs
Covered lines:34
Uncovered lines:20
Coverable lines:54
Total lines:103
Line coverage:62.9% (34 of 54)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SetUp()0%110100%
TearDown()0%110100%
ShowOptionsForOwnerDeployedScene()0%2100%
ShowOptionsForOwnerDeployedSceneMVP()0%110100%
ShowOptionsForContributorDeployedScene()0%2100%
ShowOptionsForOwnerProjectScene()0%110100%
ShowOptionsForContributorProjectScene()0%110100%

File(s)

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

#LineLine coverage
 1using NUnit.Framework;
 2using UnityEditor;
 3
 4namespace Tests
 5{
 6    public class SceneContextMenuShould
 7    {
 8        private SceneCardViewContextMenu contextMenu;
 9
 10        [SetUp]
 11        public void SetUp()
 12        {
 13            const string prefabAssetPath =
 14                "Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Prefabs/SceneCardViewContextMenu.pr
 315            var prefab = AssetDatabase.LoadAssetAtPath<SceneCardViewContextMenu>(prefabAssetPath);
 316            contextMenu = UnityEngine.Object.Instantiate(prefab);
 317        }
 18
 19        [TearDown]
 620        public void TearDown() { UnityEngine.Object.Destroy(contextMenu.gameObject); }
 21
 22        [Test]
 23        [Explicit("Not valid for MVP version")]
 24        public void ShowOptionsForOwnerDeployedScene()
 25        {
 026            contextMenu.Show("", isSceneDeployed: true, isOwnerOrOperator: true, isContributor: false);
 27
 028            Assert.IsFalse(contextMenu.deleteButton.gameObject.activeSelf, "Option should not be displayed");
 029            Assert.IsFalse(contextMenu.shareButton.gameObject.activeSelf, "Option should not be displayed");
 030            Assert.IsFalse(contextMenu.duplicateButton.gameObject.activeSelf, "Option should not be displayed");
 031            Assert.IsFalse(contextMenu.quitContributorButton.gameObject.activeSelf, "Option should not be displayed");
 32
 033            Assert.IsTrue(contextMenu.settingsButton.gameObject.activeSelf, "Option should be displayed");
 034            Assert.IsTrue(contextMenu.duplicateAsProjectButton.gameObject.activeSelf, "Option should be displayed");
 035            Assert.IsTrue(contextMenu.downloadButton.gameObject.activeSelf, "Option should be displayed");
 036            Assert.IsTrue(contextMenu.unpublishButton.gameObject.activeSelf, "Option should be displayed");
 037        }
 38
 39        [Test]
 40        public void ShowOptionsForOwnerDeployedSceneMVP()
 41        {
 142            contextMenu.Show("", isSceneDeployed: true, isOwnerOrOperator: true, isContributor: false);
 43
 144            Assert.IsFalse(contextMenu.deleteButton.gameObject.activeSelf, "Option should not be displayed");
 145            Assert.IsFalse(contextMenu.shareButton.gameObject.activeSelf, "Option should not be displayed");
 146            Assert.IsFalse(contextMenu.duplicateButton.gameObject.activeSelf, "Option should not be displayed");
 147            Assert.IsFalse(contextMenu.quitContributorButton.gameObject.activeSelf, "Option should not be displayed");
 148            Assert.IsFalse(contextMenu.settingsButton.gameObject.activeSelf, "Option should not be displayed");
 149            Assert.IsFalse(contextMenu.duplicateAsProjectButton.gameObject.activeSelf, "Option should not be displayed")
 150            Assert.IsFalse(contextMenu.downloadButton.gameObject.activeSelf, "Option should not be displayed");
 151            Assert.IsTrue(contextMenu.unpublishButton.gameObject.activeSelf, "Option should be displayed");
 152        }
 53
 54        [Test]
 55        [Explicit("Not valid for MVP version")]
 56        public void ShowOptionsForContributorDeployedScene()
 57        {
 058            contextMenu.Show("", isSceneDeployed: true, isOwnerOrOperator: false, isContributor: true);
 59
 060            Assert.IsFalse(contextMenu.deleteButton.gameObject.activeSelf, "Option should not be displayed");
 061            Assert.IsFalse(contextMenu.shareButton.gameObject.activeSelf, "Option should not be displayed");
 062            Assert.IsFalse(contextMenu.duplicateButton.gameObject.activeSelf, "Option should not be displayed");
 063            Assert.IsFalse(contextMenu.settingsButton.gameObject.activeSelf, "Option should not be displayed");
 064            Assert.IsFalse(contextMenu.unpublishButton.gameObject.activeSelf, "Option should not be displayed");
 65
 066            Assert.IsTrue(contextMenu.duplicateAsProjectButton.gameObject.activeSelf, "Option should be displayed");
 067            Assert.IsTrue(contextMenu.downloadButton.gameObject.activeSelf, "Option should be displayed");
 068            Assert.IsTrue(contextMenu.quitContributorButton.gameObject.activeSelf, "Option should be displayed");
 069        }
 70
 71        [Test]
 72        public void ShowOptionsForOwnerProjectScene()
 73        {
 174            contextMenu.Show("", isSceneDeployed: false, isOwnerOrOperator: true, isContributor: false);
 75
 176            Assert.IsFalse(contextMenu.quitContributorButton.gameObject.activeSelf, "Option should not be displayed");
 177            Assert.IsFalse(contextMenu.duplicateAsProjectButton.gameObject.activeSelf, "Option should not be displayed")
 178            Assert.IsFalse(contextMenu.unpublishButton.gameObject.activeSelf, "Option should not be displayed");
 79
 180            Assert.IsTrue(contextMenu.duplicateButton.gameObject.activeSelf, "Option should be displayed");
 181            Assert.IsTrue(contextMenu.settingsButton.gameObject.activeSelf, "Option should be displayed");
 182            Assert.IsTrue(contextMenu.downloadButton.gameObject.activeSelf, "Option should be displayed");
 183            Assert.IsTrue(contextMenu.deleteButton.gameObject.activeSelf, "Option should be displayed");
 184            Assert.IsTrue(contextMenu.shareButton.gameObject.activeSelf, "Option should be displayed");
 185        }
 86
 87        [Test]
 88        public void ShowOptionsForContributorProjectScene()
 89        {
 190            contextMenu.Show("", isSceneDeployed: false, isOwnerOrOperator: false, isContributor: true);
 91
 192            Assert.IsFalse(contextMenu.duplicateAsProjectButton.gameObject.activeSelf, "Option should not be displayed")
 193            Assert.IsFalse(contextMenu.unpublishButton.gameObject.activeSelf, "Option should not be displayed");
 194            Assert.IsFalse(contextMenu.settingsButton.gameObject.activeSelf, "Option should not be displayed");
 195            Assert.IsFalse(contextMenu.deleteButton.gameObject.activeSelf, "Option should not be displayed");
 96
 197            Assert.IsTrue(contextMenu.duplicateButton.gameObject.activeSelf, "Option should be displayed");
 198            Assert.IsTrue(contextMenu.downloadButton.gameObject.activeSelf, "Option should be displayed");
 199            Assert.IsTrue(contextMenu.shareButton.gameObject.activeSelf, "Option should be displayed");
 1100            Assert.IsTrue(contextMenu.quitContributorButton.gameObject.activeSelf, "Option should be displayed");
 1101        }
 102    }
 103}