コード例 #1
0
 public void TrackPageEvent_InActiveTracker_ShouldNotTrack(Database db, [Content] Item item, ITracker tracker, TrackerService trackerService)
 {
     using (new TrackerSwitcher(tracker))
     {
         trackerService.TrackPageEvent(item.ID);
         tracker.CurrentPage.DidNotReceive().Register(Arg.Is <PageEventItem>(x => x.ID == item.ID));
     }
 }
コード例 #2
0
        public void TrackPageEvent_NullTracker_ShouldNotTrackEvent(Database db, [Content] Item item, ITracker tracker, TrackerService trackerService)
        {
            // Act
            trackerService.TrackPageEvent(item.ID.ToGuid());

            // Assert
            tracker.CurrentPage.DidNotReceiveWithAnyArgs().RegisterPageEvent(Arg.Any <IPageEventDefinition>());
        }
コード例 #3
0
 public void TrackPageEvent_ValidID_ShouldTrackById(Database db, [Content] Item item, ITracker tracker, TrackerService trackerService)
 {
     tracker.IsActive.Returns(true);
     using (new TrackerSwitcher(tracker))
     {
         trackerService.TrackPageEvent(item.ID);
         tracker.CurrentPage.Received(1).Register(Arg.Is <PageEventItem>(x => x.ID == item.ID));
     }
 }
コード例 #4
0
        public void TrackPageEvent_InActiveTracker_ShouldNotTrack(Database db, [Content] Item item, ITracker tracker, TrackerService trackerService)
        {
            // Arrange
            tracker.IsActive.Returns(false);
            using (new TrackerSwitcher(tracker))
            {
                // Act
                trackerService.TrackPageEvent(item.ID.ToGuid());

                // Assert
                tracker.CurrentPage.DidNotReceiveWithAnyArgs().RegisterPageEvent(Arg.Any <IPageEventDefinition>());
            }
        }
コード例 #5
0
        public void TrackPageEvent_ValidID_ShouldTrackById(Database db, [Content] Item item, ITracker tracker, TrackerService trackerService, IPageEventDefinition pageEvent)
        {
            // Arrange
            trackerService.PageEventDefinitionManager.Get(Arg.Any <Guid>(), Arg.Any <CultureInfo>()).Returns(info =>
            {
                pageEvent.Id.Returns((Guid)info[0]);
                return(pageEvent);
            });
            tracker.IsActive.Returns(true);
            using (new TrackerSwitcher(tracker))
            {
                // Act
                trackerService.TrackPageEvent(item.ID.ToGuid());

                // Assert
                tracker.CurrentPage.Received(1).RegisterPageEvent(Arg.Is <IPageEventDefinition>(x => x.Id == item.ID.ToGuid()));
            }
        }
コード例 #6
0
 public void TrackPageEvent_NullTracker_ShouldNotTrackEvent(Database db, [Content] Item item, ITracker tracker, TrackerService trackerService)
 {
     trackerService.TrackPageEvent(item.ID);
     tracker.CurrentPage.DidNotReceive().Register(Arg.Is <PageEventItem>(x => x.ID == item.ID));
 }