Esempio n. 1
0
        public void ExperienceData_InitializedTrackerAndPreviewMode_ReturnEmptyResult(IKeyBehaviorCache keyBehaviorCache, Session session, CurrentInteraction currentInteraction, ITracker tracker, Contact contact, [Frozen] IProfileProvider profileProvider, [Frozen] IDemoStateService demoState, [Greedy] DemoController sut)
        {
            demoState.IsDemoEnabled.Returns(true);
            tracker.Interaction.Returns(currentInteraction);
            tracker.Session.Returns(session);
            var attachments = new Dictionary <string, object>
            {
                ["KeyBehaviorCache"] = new Analytics.Tracking.KeyBehaviorCache(keyBehaviorCache)
            };

            contact.Attachments.Returns(attachments);
            tracker.Contact.Returns(contact);

            var fakeSite = new FakeSiteContext(new StringDictionary
            {
                { "enablePreview", "true" },
                { "masterDatabase", "master" }
            }) as SiteContext;

            using (new SiteContextSwitcher(fakeSite))
            {
                Sitecore.Context.Site.SetDisplayMode(DisplayMode.Preview, DisplayModeDuration.Remember);
                using (new TrackerSwitcher(tracker))
                {
                    sut.ExperienceData().Should().BeOfType <EmptyResult>();
                }
            }
        }
Esempio n. 2
0
        public void ExperienceData_InitializedTrackerAndNormalMode_ReturnExperienceData(IKeyBehaviorCache keyBehaviorCache, Session session, CurrentInteraction currentInteraction, ITracker tracker, Contact contact, [Frozen] IProfileProvider profileProvider, [Frozen] IDemoStateService demoState, [Frozen] IExperienceDataFactory dataFactory, [Greedy] DemoController sut)
        {
            demoState.IsDemoEnabled.Returns(true);
            dataFactory.Get().Returns(new ExperienceData());
            tracker.Interaction.Returns(currentInteraction);
            tracker.Session.Returns(session);
            var attachments = new Dictionary <string, object>
            {
                ["KeyBehaviorCache"] = new Analytics.Tracking.KeyBehaviorCache(keyBehaviorCache)
            };

            contact.Attachments.Returns(attachments);
            tracker.Contact.Returns(contact);

            var fakeSite = new FakeSiteContext(new StringDictionary
            {
                { "displayMode", "normal" }
            }) as SiteContext;

            using (new SiteContextSwitcher(fakeSite))
            {
                using (new TrackerSwitcher(tracker))
                {
                    var result = sut.ExperienceData();
                    result.Should().BeOfType <ViewResult>().Which.Model.Should().BeOfType <ExperienceData>();
                }
            }
        }
Esempio n. 3
0
 public void ExperienceData_NullInteraction_ReturnNull(ITracker tracker, [Greedy] DemoController demoController)
 {
     using (new TrackerSwitcher(tracker))
     {
         demoController.ExperienceData().Should().BeNull();
     }
 }
Esempio n. 4
0
        public void ExperienceData_InitializedTracker_ReturnExperienceData(IKeyBehaviorCache keyBehaviorCache, Session session, CurrentInteraction currentInteraction, ITracker tracker, [Frozen] IContactProfileProvider contactProfileProvider, [Frozen] IProfileProvider profileProvider, [Greedy] DemoController demoController)
        {
            tracker.Interaction.Returns(currentInteraction);
            tracker.Session.Returns(session);
            var attachments = new Dictionary <string, object>()
            {
                ["KeyBehaviorCache"] = new Sitecore.Analytics.Tracking.KeyBehaviorCache(keyBehaviorCache)
            };

            tracker.Contact.Attachments.Returns(attachments);

            using (new TrackerSwitcher(tracker))
            {
                demoController.ExperienceData().Should().BeOfType <ViewResult>().Which.Model.Should().BeOfType <ExperienceData>();
            }
        }
Esempio n. 5
0
 public void ExperienceData_NullInteraction_ReturnNull([Greedy] DemoController sut, TrackerSwitcher trackerSwitcher)
 {
     sut.ExperienceData().Should().BeNull();
 }
Esempio n. 6
0
 public void ExperienceData_NullTracker_ReturnNull([Greedy] DemoController sut)
 {
     sut.ExperienceData().Should().BeNull();
 }
Esempio n. 7
0
 public void ExperienceData_NullInteraction_ReturnNull([Frozen] IDemoStateService demoState, [Greedy] DemoController sut, TrackerSwitcher trackerSwitcher)
 {
     demoState.IsDemoEnabled.Returns(true);
     sut.ExperienceData().Should().BeNull();
 }