< Summary

Class:FriendRequestEntry
Assembly:FriendsHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/FriendsHUD/Scripts/Entries/FriendRequestEntry.cs
Covered lines:23
Uncovered lines:1
Coverable lines:24
Total lines:53
Line coverage:95.8% (23 of 24)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
SetReceived(...)0%220100%
PopulateReceived()0%110100%
PopulateSent()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/FriendsHUD/Scripts/Entries/FriendRequestEntry.cs

#LineLine coverage
 1using UnityEngine;
 2using UnityEngine.UI;
 3
 4public class FriendRequestEntry : FriendEntryBase
 5{
 6    [SerializeField] internal Button acceptButton;
 7    [SerializeField] internal Button rejectButton;
 8    [SerializeField] internal Button cancelButton;
 9
 010    public bool isReceived { get; private set; }
 11
 12    public event System.Action<FriendRequestEntry> OnAccepted;
 13    public event System.Action<FriendRequestEntry> OnRejected;
 14    public event System.Action<FriendRequestEntry> OnCancelled;
 15
 16    public override void Awake()
 17    {
 3518        base.Awake();
 19
 3520        acceptButton.onClick.RemoveAllListeners();
 3521        rejectButton.onClick.RemoveAllListeners();
 3522        cancelButton.onClick.RemoveAllListeners();
 3623        acceptButton.onClick.AddListener(() => OnAccepted?.Invoke(this));
 3824        rejectButton.onClick.AddListener(() => OnRejected?.Invoke(this));
 3825        cancelButton.onClick.AddListener(() => OnCancelled?.Invoke(this));
 3526    }
 27
 28    public void SetReceived(bool value)
 29    {
 1430        isReceived = value;
 31
 1432        if (isReceived)
 933            PopulateReceived();
 34        else
 535            PopulateSent();
 536    }
 37
 38    void PopulateReceived()
 39    {
 940        isReceived = true;
 941        cancelButton.gameObject.SetActive(false);
 942        acceptButton.gameObject.SetActive(true);
 943        rejectButton.gameObject.SetActive(true);
 944    }
 45
 46    void PopulateSent()
 47    {
 548        isReceived = false;
 549        cancelButton.gameObject.SetActive(true);
 550        acceptButton.gameObject.SetActive(false);
 551        rejectButton.gameObject.SetActive(false);
 552    }
 53}