< Summary

Class:PlayerInfoCardHUDControllerShould
Assembly:PlayerInfoCardHUDTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/PlayerInfoCardHUD/Tests/PlayerInfoCardHUDControllerShould.cs
Covered lines:21
Uncovered lines:0
Coverable lines:21
Total lines:57
Line coverage:100% (21 of 21)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SetUp()0%330100%
TearDown()0%330100%
CreateTheView()0%110100%
CurrentPlayerNameIsFound()0%110100%
ReactToCurrentPlayerNameChanges()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/PlayerInfoCardHUD/Tests/PlayerInfoCardHUDControllerShould.cs

#LineLine coverage
 1using NUnit.Framework;
 2using System.Collections;
 3using UnityEngine;
 4
 5public class PlayerInfoCardHUDControllerShould : IntegrationTestSuite_Legacy
 6{
 7    private PlayerInfoCardHUDController controller;
 8
 9    protected override IEnumerator SetUp()
 10    {
 311        yield return base.SetUp();
 312        controller = new PlayerInfoCardHUDController();
 313        UserProfileController.i.AddUserProfileToCatalog(new UserProfileModel()
 14        {
 15            userId = "userId",
 16            name = "username",
 17            description = "description",
 18            email = "email",
 19            inventory = new string[] { }
 20        });
 321    }
 22
 23    protected override IEnumerator TearDown()
 24    {
 325        controller.Dispose();
 326        yield return base.TearDown();
 327    }
 28
 29    [Test]
 30    public void CreateTheView()
 31    {
 132        Assert.IsNotNull(controller.view);
 133        Assert.IsNotNull(controller.view.gameObject);
 134    }
 35
 36    [Test]
 37    public void CurrentPlayerNameIsFound()
 38    {
 139        var currentPlayerName = Resources.Load<StringVariable>(PlayerInfoCardHUDController.CURRENT_PLAYER_ID);
 140        Assert.IsNotNull(controller.currentPlayerId);
 141        Assert.AreEqual(currentPlayerName, controller.currentPlayerId);
 142    }
 43
 44    [Test]
 45    public void ReactToCurrentPlayerNameChanges()
 46    {
 47        UserProfile userProfile;
 148        using (var iterator = UserProfileController.userProfilesCatalog.GetEnumerator())
 49        {
 150            iterator.MoveNext();
 151            userProfile = iterator.Current.Value;
 152        }
 53
 154        controller.currentPlayerId.Set(userProfile.userId);
 155        Assert.AreEqual(controller.currentUserProfile, userProfile);
 156    }
 57}