public void TrackPageEvent_InActiveTracker_ShouldNotTrack(Database db, [Content] Item item, ITracker tracker, AccountTrackerService accountTrackerService) { using (new TrackerSwitcher(tracker)) { accountTrackerService.TrackPageEvent(item.ID); tracker.CurrentPage.DidNotReceive().Register(Arg.Is<PageEventItem>(x => x.ID == item.ID)); } }
public void TrackPageEvent_ValidID_ShouldTrackById(Database db, [Content] Item item, ITracker tracker, AccountTrackerService accountTrackerService) { tracker.IsActive.Returns(true); using (new TrackerSwitcher(tracker)) { accountTrackerService.TrackPageEvent(item.ID); tracker.CurrentPage.Received(1).Register(Arg.Is<PageEventItem>(x => x.ID == item.ID)); } }
public void TrackLogin_Call_ShouldTrackLoginGoal(string identifier, Db db, ITracker tracker, AccountTrackerService accountTrackerService, [Substitute] Session session) { tracker.IsActive.Returns(true); tracker.Session.Returns(session); db.Add(new DbItem("Item", ConfigSettings.LoginGoalId)); using (new TrackerSwitcher(tracker)) { accountTrackerService.TrackLogin(identifier); tracker.CurrentPage.Received(1).Register(Arg.Is<PageEventItem>(x => x.ID == ConfigSettings.LoginGoalId)); } }
public void TrackRegister_Call_ShouldTrackRegistrationGoal(Db db, ID outcomeID, ITracker tracker, [Frozen]IAccountsSettingsService accountsSettingsService, AccountTrackerService accountTrackerService) { // Arrange tracker.IsActive.Returns(true); tracker.Contact.Returns(Substitute.For<Contact>()); tracker.Interaction.Returns(Substitute.For<CurrentInteraction>()); tracker.Session.Returns(Substitute.For<Session>()); tracker.Session.CustomData.Returns(new Dictionary<string, object>()); accountsSettingsService.GetRegistrationOutcome(Arg.Any<Item>()).Returns(outcomeID); db.Add(new DbItem("Item", ConfigSettings.RegistrationGoalId)); db.Add(new DbItem("Item", ConfigSettings.LoginGoalId)); using (new TrackerSwitcher(tracker)) { accountTrackerService.TrackRegistration(); tracker.CurrentPage.Received(1).Register(Arg.Is<PageEventItem>(x => x.ID == ConfigSettings.RegistrationGoalId)); tracker.GetContactOutcomes().Should().Contain(o => o.DefinitionId == outcomeID); } }
public void TrackPageEvent_NullTracker_ShouldNotTrackEvent(Database db, [Content] Item item, ITracker tracker, AccountTrackerService accountTrackerService) { accountTrackerService.TrackPageEvent(item.ID); tracker.CurrentPage.DidNotReceive().Register(Arg.Is<PageEventItem>(x => x.ID == item.ID)); }
public void TrackPageEvent_NullEvent_ShouldThrowArgumentException(AccountTrackerService accountTrackerService) { accountTrackerService.Invoking(x => x.TrackPageEvent(null)).ShouldThrow<ArgumentNullException>(); }