< 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:26
Uncovered lines:1
Coverable lines:27
Total lines:59
Line coverage:96.2% (26 of 27)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
Populate(...)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    {
 1518        base.Awake();
 19
 1520        acceptButton.onClick.RemoveAllListeners();
 1521        rejectButton.onClick.RemoveAllListeners();
 1522        cancelButton.onClick.RemoveAllListeners();
 1623        acceptButton.onClick.AddListener(() => OnAccepted?.Invoke(this));
 1624        rejectButton.onClick.AddListener(() => OnRejected?.Invoke(this));
 1625        cancelButton.onClick.AddListener(() => OnCancelled?.Invoke(this));
 1526    }
 27
 28    public override void Populate(FriendEntryModel model)
 29    {
 1130        base.Populate(model);
 1131        SetReceived(((FriendRequestEntryModel) model).isReceived);
 1132    }
 33
 34    public void SetReceived(bool value)
 35    {
 1136        isReceived = value;
 37
 1138        if (isReceived)
 439            PopulateReceived();
 40        else
 741            PopulateSent();
 742    }
 43
 44    void PopulateReceived()
 45    {
 446        isReceived = true;
 447        cancelButton.gameObject.SetActive(false);
 448        acceptButton.gameObject.SetActive(true);
 449        rejectButton.gameObject.SetActive(true);
 450    }
 51
 52    void PopulateSent()
 53    {
 754        isReceived = false;
 755        cancelButton.gameObject.SetActive(true);
 756        acceptButton.gameObject.SetActive(false);
 757        rejectButton.gameObject.SetActive(false);
 758    }
 59}