< Summary

Class:DCLServices.PortableExperiences.Analytics.PortableExperiencesAnalyticsService
Assembly:PortableExperiencesAnalytics
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLServices/PortableExperiences/Analytics/PortableExperiencesAnalyticsService.cs
Covered lines:9
Uncovered lines:4
Coverable lines:13
Total lines:54
Line coverage:69.2% (9 of 13)
Covered branches:0
Total branches:0
Covered methods:5
Total methods:7
Method coverage:71.4% (5 of 7)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PortableExperiencesAnalyticsService(...)0%110100%
Dispose()0%110100%
Initialize()0%110100%
Spawn(...)0%110100%
Accept(...)0%2100%
Reject(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLServices/PortableExperiences/Analytics/PortableExperiencesAnalyticsService.cs

#LineLine coverage
 1using System.Collections.Generic;
 2
 3namespace DCLServices.PortableExperiences.Analytics
 4{
 5    public class PortableExperiencesAnalyticsService : IPortableExperiencesAnalyticsService
 6    {
 7        private readonly IAnalytics analytics;
 8        private readonly IUserProfileBridge userProfileBridge;
 9
 210        private string ownUserId => userProfileBridge.GetOwn().userId;
 11
 42512        public PortableExperiencesAnalyticsService(IAnalytics analytics,
 13            IUserProfileBridge userProfileBridge)
 14        {
 42515            this.analytics = analytics;
 42516            this.userProfileBridge = userProfileBridge;
 42517        }
 18
 42519        public void Dispose() { }
 20
 42521        public void Initialize() { }
 22
 23        public void Spawn(string pexId)
 24        {
 225            analytics.SendAnalytic("spawn_portable_experience", new Dictionary<string, string>
 26            {
 27                { "wallet_id", ownUserId },
 28                { "pex_urn", pexId },
 29            });
 230        }
 31
 32        public void Accept(string pexId, bool dontAskAgain, string source)
 33        {
 034            analytics.SendAnalytic("player_accept_portable_experience", new Dictionary<string, string>
 35            {
 36                { "wallet_id", ownUserId },
 37                { "pex_urn", pexId },
 38                { "dont_ask_again_flag", dontAskAgain.ToString().ToLower() },
 39                { "triggered_from", source },
 40            });
 041        }
 42
 43        public void Reject(string pexId, bool dontAskAgain, string source)
 44        {
 045            analytics.SendAnalytic("player_reject_portable_experience", new Dictionary<string, string>
 46            {
 47                { "wallet_id", ownUserId },
 48                { "pex_urn", pexId },
 49                { "dont_ask_again_flag", dontAskAgain.ToString().ToLower() },
 50                { "triggered_from", source },
 51            });
 052        }
 53    }
 54}