Beispiel #1
0
        public bool Include(object item)
        {
            var visit = (item as IVisitAggregationContext).TryGet(v => v.Visit);

            if (visit != null)
            {
                var tracker = _trackerFactory(visit);
                TrackerSwitcher.Enter(tracker);
                try
                {
                    var rulesContext = new RuleContext();

                    rulesContext.Item = RuleContextItem;
                    _rules.Run(rulesContext);
                    object addToSegment;
                    var    include = !rulesContext.IsAborted &&
                                     rulesContext.Parameters.TryGetValue("addVisit", out addToSegment) &&
                                     (bool)addToSegment;

                    return(include);
                }
                finally
                {
                    if (Tracker.Current == tracker)
                    {
                        TrackerSwitcher.Exit();
                    }
                }
            }

            return(false);
        }
Beispiel #2
0
        public PersonalisationContext(string placeholder)
        {
            PageContext pageContext = this.CreatePageContext(new System.Web.HttpContextWrapper(HttpContext.Current));

            _context = ContextService.Get().Push(pageContext);
            var tracker = new NullTracker(new StandardSession())
            {
                IsActive = true
            };

            Context.Site.SetDisplayMode(DisplayMode.Normal, DisplayModeDuration.Temporary);
            _tracker     = new TrackerSwitcher(tracker);
            _placeholder = ContextService.Get().Push(new PlaceholderContext(placeholder));
        }
Beispiel #3
0
 public void ExperienceData_NullInteraction_ReturnNull([Greedy] DemoController sut, TrackerSwitcher trackerSwitcher)
 {
     sut.ExperienceData().Should().BeNull();
 }
 public void ExperienceData_NullInteraction_ReturnNull([Greedy] DemoController sut, TrackerSwitcher trackerSwitcher)
 {
     sut.ExperienceData().Should().BeNull();
 }
Beispiel #5
0
 public void ExperienceData_NullInteraction_ReturnNull([Frozen] IDemoStateService demoState, [Greedy] DemoController sut, TrackerSwitcher trackerSwitcher)
 {
     demoState.IsDemoEnabled.Returns(true);
     sut.ExperienceData().Should().BeNull();
 }