< 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:20
Uncovered lines:1
Coverable lines:21
Total lines:50
Line coverage:95.2% (20 of 21)
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
 3620        acceptButton.onClick.AddListener(() => OnAccepted?.Invoke(this));
 3821        rejectButton.onClick.AddListener(() => OnRejected?.Invoke(this));
 3822        cancelButton.onClick.AddListener(() => OnCancelled?.Invoke(this));
 3523    }
 24
 25    public void SetReceived(bool value)
 26    {
 1427        isReceived = value;
 28
 1429        if (isReceived)
 930            PopulateReceived();
 31        else
 532            PopulateSent();
 533    }
 34
 35    void PopulateReceived()
 36    {
 937        isReceived = true;
 938        cancelButton.gameObject.SetActive(false);
 939        acceptButton.gameObject.SetActive(true);
 940        rejectButton.gameObject.SetActive(true);
 941    }
 42
 43    void PopulateSent()
 44    {
 545        isReceived = false;
 546        cancelButton.gameObject.SetActive(true);
 547        acceptButton.gameObject.SetActive(false);
 548        rejectButton.gameObject.SetActive(false);
 549    }
 50}