< Summary

Class:FriendsController_Mock
Assembly:FriendsControllerTests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/FriendsController/Tests/Helpers/FriendsController_Mock.cs
Covered lines:13
Uncovered lines:2
Coverable lines:15
Total lines:41
Line coverage:86.6% (13 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
FriendsController_Mock()0%110100%
GetFriends()0%110100%
RaiseUpdateFriendship(...)0%6.566075%
RaiseUpdateUserStatus(...)0%220100%
RaiseOnFriendNotFound(...)0%220100%
AddFriend(...)0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/FriendsController/Tests/Helpers/FriendsController_Mock.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3
 4public class FriendsController_Mock : IFriendsController
 5{
 6    public event Action<string, FriendshipAction> OnUpdateFriendship;
 7    public event Action<string, FriendsController.UserStatus> OnUpdateUserStatus;
 8    public event Action<string> OnFriendNotFound;
 9    public event Action OnInitialized;
 10
 3211    Dictionary<string, FriendsController.UserStatus> friends = new Dictionary<string, FriendsController.UserStatus>();
 12
 3713    public int friendCount => friends.Count;
 14
 3015    public bool isInitialized => true;
 16
 917    public Dictionary<string, FriendsController.UserStatus> GetFriends() { return friends; }
 18
 19    public void RaiseUpdateFriendship(string id, FriendshipAction action)
 20    {
 1821        if (action == FriendshipAction.NONE)
 22        {
 023            if (friends.ContainsKey(id))
 024                friends.Remove(id);
 25        }
 26
 1827        if (action == FriendshipAction.APPROVED)
 28        {
 1129            if (!friends.ContainsKey(id))
 1130                friends.Add(id, new FriendsController.UserStatus());
 31        }
 32
 1833        OnUpdateFriendship?.Invoke(id, action);
 1834    }
 35
 1636    public void RaiseUpdateUserStatus(string id, FriendsController.UserStatus userStatus) { OnUpdateUserStatus?.Invoke(i
 37
 238    public void RaiseOnFriendNotFound(string id) { OnFriendNotFound?.Invoke(id); }
 39
 3040    public void AddFriend(FriendsController.UserStatus newFriend) { friends.Add(newFriend.userId, newFriend); }
 41}