Exemplo n.º 1
0
        public Session(BeaconSender beaconSender, Beacon beacon)
        {
            this.beaconSender = beaconSender;
            this.beacon       = beacon;

            beaconSender.StartSession(this);
        }
Exemplo n.º 2
0
        protected OpenKit(ILogger logger,
                          OpenKitConfiguration configuration,
                          IHTTPClientProvider httpClientProvider,
                          ITimingProvider timingProvider,
                          IThreadIDProvider threadIDProvider)
        {
            if (logger.IsInfoEnabled)
            {
                //TODO: Use proper version information (incl. the build number)
                logger.Info(configuration.OpenKitType + " " + GetType().Name + " " + OpenKitConstants.DEFAULT_APPLICATION_VERSION + " instantiated");
            }
            if (logger.IsDebugEnabled)
            {
                logger.Debug(
                    "applicationName=" + configuration.ApplicationName + ", applicationID=" + configuration.ApplicationID
                    + ", deviceID=" + configuration.DeviceID + ", endpointURL=" + configuration.EndpointURL
                    );
            }
            this.configuration    = configuration;
            this.logger           = logger;
            this.timingProvider   = timingProvider;
            this.threadIDProvider = threadIDProvider;

            beaconCache        = new BeaconCache(logger);
            beaconSender       = new BeaconSender(logger, configuration, httpClientProvider, timingProvider);
            beaconCacheEvictor = new BeaconCacheEvictor(logger, beaconCache, configuration.BeaconCacheConfig, timingProvider);
        }
Exemplo n.º 3
0
        public Session(ILogger logger, BeaconSender beaconSender, Beacon beacon)
        {
            this.logger       = logger;
            this.beaconSender = beaconSender;
            this.beacon       = beacon;

            beaconSender.StartSession(this);
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            logger = Substitute.For <ILogger>();
            logger.IsDebugEnabled.Returns(true);

            beaconSendingContext = Substitute.For <IBeaconSendingContext>();
            beaconSender         = new BeaconSender(beaconSendingContext);

            mockTimingProvider = Substitute.For <ITimingProvider>();
            var configuration = new TestConfiguration();

            beacon = new Beacon(logger, new Caching.BeaconCache(), configuration, "127.0.0.1", Substitute.For <IThreadIDProvider>(), mockTimingProvider);
        }
Exemplo n.º 5
0
        protected OpenKit(ILogger logger,
                          OpenKitConfiguration configuration,
                          IHTTPClientProvider httpClientProvider,
                          ITimingProvider timingProvider,
                          IThreadIDProvider threadIDProvider)
        {
            this.configuration    = configuration;
            this.logger           = logger;
            this.timingProvider   = timingProvider;
            this.threadIDProvider = threadIDProvider;

            beaconCache        = new BeaconCache();
            beaconSender       = new BeaconSender(configuration, httpClientProvider, timingProvider);
            beaconCacheEvictor = new BeaconCacheEvictor(logger, beaconCache, configuration.BeaconCacheConfig, timingProvider);
        }
Exemplo n.º 6
0
        public void IsInitializedGetsValueFromContext()
        {
            // given
            var target = new BeaconSender(context);

            // when context is not initialized
            context.IsInitialized.Returns(false);

            // then
            Assert.That(target.IsInitialized, Is.False);

            // and when context is initialized
            context.IsInitialized.Returns(true);

            // then
            Assert.That(target.IsInitialized, Is.True);
        }