Exemplo n.º 1
0
        public void NoConsentStrategyTest()
        {
            var noConsentStategy = new NoConsentStrategy(visitorDelegate);

            var VisitorCacheImplementation = new Mock <Flagship.Cache.IVisitorCacheImplementation>();
            var HitCaheImplementation      = new Mock <Cache.IHitCacheImplementation>();

            config.VisitorCacheImplementation = VisitorCacheImplementation.Object;
            config.HitCacheImplementation     = HitCaheImplementation.Object;

            noConsentStategy.CacheHit(flagDTO: null);
            noConsentStategy.CacheHit(hit: null);
            noConsentStategy.CacheVisitorAsync();
            noConsentStategy.LookupHits();
            noConsentStategy.LookupVisitor();

            VisitorCacheImplementation.Verify(x => x.CacheVisitor(It.IsAny <string>(), It.IsAny <JObject>()), Times.Never());
            HitCaheImplementation.Verify(x => x.CacheHit(It.IsAny <string>(), It.IsAny <JObject>()), Times.Never());

            var privateNoConsentStrategy = new PrivateObject(noConsentStategy);

            ICollection <Campaign> compaigns = (ICollection <Campaign>)privateNoConsentStrategy.Invoke("FetchVisitorCacheCampaigns", visitorDelegate);

            Assert.AreEqual(compaigns.Count, 0);
        }
Exemplo n.º 2
0
        public async Task SendHitTest()
        {
            var noConsentStategy = new NoConsentStrategy(visitorDelegate);

            await noConsentStategy.SendHit(new Flagship.Hit.Screen("Home")).ConfigureAwait(false);

            fsLogManagerMock.Verify(x => x.Error(string.Format(Constants.METHOD_DEACTIVATED_CONSENT_ERROR, "SendHit", visitorDelegate.VisitorId), "SendHit"), Times.Once());
        }
Exemplo n.º 3
0
        public async Task UserExposedTest()
        {
            var noConsentStategy = new NoConsentStrategy(visitorDelegate);
            var defaultValue     = "default";
            await noConsentStategy.UserExposed("key", defaultValue, null).ConfigureAwait(false);

            fsLogManagerMock.Verify(x => x.Error(string.Format(Constants.METHOD_DEACTIVATED_CONSENT_ERROR, "UserExposed", visitorDelegate.VisitorId), "UserExposed"), Times.Once());
        }