private IUnityAnalytics GetAnalyticsForResult(AnalyticsResult i_result)
        {
            IUnityAnalytics analytics = Substitute.For <IUnityAnalytics>();

            analytics.SendCustomEvent(Arg.Any <string>(), Arg.Any <IDictionary <string, object> >()).Returns(i_result);
            return(analytics);
        }
예제 #2
0
        public void BeforeTest()
        {
            mTimer = Substitute.For <ITimer>();
            mAnalyticsTimerUnderTest = new AnalyticsTimer(ANALYTIC_NAME, mTimer);

            mAnalytics        = Substitute.For <IUnityAnalytics>();
            mAnalyticsManager = new UnityAnalyticsManager(mAnalytics);
        }
        public void OnSentMessage_FailedAnalytic_WarningLogSent()
        {
            IUnityAnalytics badAnalytics = GetAnalyticsForResult(AnalyticsResult.InvalidData);

            mManagerUnderTest = new UnityAnalyticsManager(badAnalytics);
            MyMessenger.Instance.Send <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, ANALYTIC_NAME, ANALYTIC_DATA);

            EasyLogger.Instance.Received().Log(LogTypes.Warn, Arg.Any <string>(), Arg.Any <string>());
        }
        public void OnSentMessage_OkAnalytic_NoWarningLog()
        {
            IUnityAnalytics okAnalytics = GetAnalyticsForResult(AnalyticsResult.Ok);

            mManagerUnderTest = new UnityAnalyticsManager(okAnalytics);
            MyMessenger.Instance.Send <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, ANALYTIC_NAME, ANALYTIC_DATA);

            EasyLogger.Instance.DidNotReceive().Log(LogTypes.Warn, Arg.Any <string>(), Arg.Any <string>());
        }
        public void OnSendMessage_CustomAnalyticIsSent()
        {
            IUnityAnalytics okAnalytics = GetAnalyticsForResult(AnalyticsResult.Ok);

            mManagerUnderTest = new UnityAnalyticsManager(okAnalytics);
            MyMessenger.Instance.Send <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, ANALYTIC_NAME, ANALYTIC_DATA);

            okAnalytics.Received().SendCustomEvent(ANALYTIC_NAME, ANALYTIC_DATA);
        }
예제 #6
0
 public BillerFactory(IResourceLoader resourceLoader, Uniject.ILogger logger,
                      IStorage storage, IRawBillingPlatformProvider platformProvider,
                      UnibillConfiguration config, IUtil util, IUnityAnalytics analytics)
 {
     this.loader           = resourceLoader;
     this.logger           = logger;
     this.storage          = storage;
     this.platformProvider = platformProvider;
     this.config           = config;
     this.util             = util;
     this.analytics        = analytics;
 }
예제 #7
0
        /// <summary>
        /// Created for integration testing.
        /// </summary>
        internal static void Initialize(IStoreListener listener, ConfigurationBuilder builder,
                                        ILogger logger, string persistentDatapath, IUnityAnalytics analytics, ICatalogProvider catalog)
        {
            var transactionLog    = new TransactionLog(logger, persistentDatapath);
            var manager           = new PurchasingManager(transactionLog, logger, builder.factory.service, builder.factory.storeName);
            var analyticsReporter = new AnalyticsReporter(analytics);

            // Proxy the PurchasingManager's callback interface to forward Transactions to Analytics.
            var proxy = new StoreListenerProxy(listener, analyticsReporter, builder.factory);

            FetchAndMergeProducts(builder.useCatalogProvider, builder.products, catalog, response =>
            {
                manager.Initialize(proxy, response);
            });
        }
예제 #8
0
 public AnalyticsReporter(IUnityAnalytics analytics)
 {
     m_Analytics = analytics;
 }
 public AnalyticsReporter(BillingPlatform platform, IUnityAnalytics analytics)
 {
     this.platform  = platform;
     this.analytics = analytics;
 }
예제 #10
0
 public UnityAnalyticsManager(IUnityAnalytics i_unityAnalytics)
 {
     mAnalytics = i_unityAnalytics;
     MyMessenger.AddListener <string, IDictionary <string, object> >(LibraryAnalyticEvents.SEND_ANALYTIC_EVENT, OnAnalyticEvent);
 }
예제 #11
0
 public AnalyticsReporter(IUnityAnalytics analytics)
 {
     this.m_Analytics = analytics;
 }