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)); } }
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>()); }
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)); } }
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>()); } }
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())); } }
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)); }