< Summary

Class:DCL.Social.Friends.ReportFriendRequestToAnalyticsExtensions
Assembly:FriendsController
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/FriendsController/ReportFriendRequestToAnalyticsExtensions.cs
Covered lines:5
Uncovered lines:3
Coverable lines:8
Total lines:44
Line coverage:62.5% (5 of 8)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ReportFriendRequestErrorToAnalyticsByRequestId(...)0%660100%
ReportFriendRequestErrorToAnalyticsByUserId(...)0%42600%
ReportFriendRequestErrorToAnalyticsAsSender(...)0%440100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/FriendsController/ReportFriendRequestToAnalyticsExtensions.cs

#LineLine coverage
 1using SocialFeaturesAnalytics;
 2using System;
 3
 4namespace DCL.Social.Friends
 5{
 6    public static class ReportFriendRequestToAnalyticsExtensions
 7    {
 8        public static void ReportFriendRequestErrorToAnalyticsByRequestId(this Exception e, string friendRequestId,
 9            string source,
 10            IFriendsController friendsController, ISocialAnalytics socialAnalytics)
 11        {
 312            FriendRequest request = friendsController.GetAllocatedFriendRequest(friendRequestId);
 313            socialAnalytics.SendFriendRequestError(request?.From, request?.To,
 14                source,
 15                e is FriendshipException fe
 16                    ? fe.ErrorCode.ToString()
 17                    : FriendRequestErrorCodes.Unknown.ToString());
 318        }
 19
 20        public static void ReportFriendRequestErrorToAnalyticsByUserId(this Exception e, string userId,
 21            string source,
 22            IFriendsController friendsController, ISocialAnalytics socialAnalytics)
 23        {
 024            FriendRequest request = friendsController.GetAllocatedFriendRequestByUser(userId);
 25
 026            socialAnalytics.SendFriendRequestError(request?.From, request?.To,
 27                source,
 28                e is FriendshipException fe
 29                    ? fe.ErrorCode.ToString()
 30                    : FriendRequestErrorCodes.Unknown.ToString());
 031        }
 32
 33        public static void ReportFriendRequestErrorToAnalyticsAsSender(this Exception e, string recipientId,
 34            string source,
 35            IUserProfileBridge userProfileBridge, ISocialAnalytics socialAnalytics)
 36        {
 137            socialAnalytics.SendFriendRequestError(userProfileBridge.GetOwn()?.userId, recipientId,
 38                source,
 39                e is FriendshipException fe
 40                    ? fe.ErrorCode.ToString()
 41                    : FriendRequestErrorCodes.Unknown.ToString());
 142        }
 43    }
 44}