public ExperienceData(IContactProfileProvider contactProfileProvider, IProfileProvider profileProvider) { this.Visits = new VisitsRepository(contactProfileProvider).Get(); this.PersonalInfo = new PersonalInfoRepository(contactProfileProvider).Get(); this.OnsiteBehavior = new OnsiteBehaviorRepository(profileProvider).Get(); this.Referral = new ReferralRepository().Get(); }
public void ContactDetails_ContactInitialized_ShouldReturnContactInformation(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker) { //arrange var controller = new DemoController(contact, profile); using (new TrackerSwitcher(tracker)) { controller.ContactDetails().As<ViewResult>().Model.Should().BeOfType<ContactInformation>(); } }
public void VisitDetails_TrackerInteractionNotInitialized_ShouldReturnNull(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker) { //arrange var controller = new DemoController(contact, profile); using (new TrackerSwitcher(tracker)) { controller.VisitDetails().Should().Be(null); } }
public void VisitDetails_TrackerInitialized_ShouldReturnVisitInformation(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker, CurrentInteraction interaction) { tracker.Interaction.Returns(interaction); //arrange var controller = new DemoController(contact, profile); using (new TrackerSwitcher(tracker)) { controller.VisitDetails().As<ViewResult>().Model.Should().BeOfType<VisitInformation>(); } }
public void ContactDetails_ContactNotInitialized_ShouldReturnNull(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker) { tracker.Contact.Returns((Contact)null); //arrange var controller = new DemoController(contact, profile); using (new TrackerSwitcher(tracker)) { controller.ContactDetails().Should().BeNull(); } }
public void DemoContent_RenderingContextItemInitialized_ShouldReturnDemoContentView(Db db,IContactProfileProvider contact, IProfileProvider profile, ITracker tracker) { //arrange var itemID = ID.NewID; db.Add(new DbItem("ctx",itemID, Templates.DemoContent.ID)); var controller = new DemoController(contact, profile); var context = new RenderingContext(); context.ContextItem = db.GetItem(itemID); ContextService.Get().Push(context); using (new TrackerSwitcher(tracker)) { controller.DemoContent().As<ViewResult>().Model.Should().BeOfType<DemoContent>(); } }
public void EngagementValue_ShouldReturnFromProvider(IContactProfileProvider provider, int number) { provider.Contact.System.Value.Returns(number); var model = new ContactInformation(provider); model.EngagementValue.Should().Be(number); }
public void NoOfVisits_ShouldReturnFromProvider(IContactProfileProvider provider, int number) { provider.Contact.System.VisitCount.Returns(number); var model = new ContactInformation(provider); model.NoOfVisits.Should().Be(number); }
public DemoController(IContactProfileProvider contactProfileProvider) { this.contactProfileProvider = contactProfileProvider; }
public ContactProfileService(IContactProfileProvider contactProfileProvider) { this.contactProfileProvider = contactProfileProvider; }
public void DemoContent_RenderingContextItemNotInitialized_ShouldThrowException(IContactProfileProvider contact, IProfileProvider profile, ITracker tracker) { //arrange var controller = new DemoController(contact, profile); var context = new RenderingContext(); ContextService.Get().Push(context); using (new TrackerSwitcher(tracker)) { controller.Invoking(x => x.DemoContent()).ShouldThrow<InvalidDataSourceItemException>(); } }
public void IdentificationStatus_ShouldReturnFromProvider(IContactProfileProvider provider, ContactIdentificationLevel expected) { provider.Contact.Identifiers.IdentificationLevel.Returns(expected); var model = new ContactInformation(provider); model.IdentificationStatus.Should().Be(expected.ToString()); }
public void ExperienceData_InitializedTrackerAndNormalMode_ReturnExperienceData(IKeyBehaviorCache keyBehaviorCache, Session session, CurrentInteraction currentInteraction, ITracker tracker, [Frozen] IContactProfileProvider contactProfileProvider, [Frozen] IProfileProvider profileProvider, [Greedy] DemoController sut) { tracker.Interaction.Returns(currentInteraction); tracker.Session.Returns(session); var attachments = new Dictionary <string, object> { ["KeyBehaviorCache"] = new Analytics.Tracking.KeyBehaviorCache(keyBehaviorCache) }; tracker.Contact.Attachments.Returns(attachments); var fakeSite = new FakeSiteContext(new StringDictionary { { "displayMode", "normal" } }) as SiteContext; using (new SiteContextSwitcher(fakeSite)) { using (new TrackerSwitcher(tracker)) { sut.ExperienceData().Should().BeOfType <ViewResult>().Which.Model.Should().BeOfType <ExperienceData>(); } } }
public void ExperienceData_InitializedTrackerAndPreviewMode_ReturnEmptyResult(IKeyBehaviorCache keyBehaviorCache, Session session, CurrentInteraction currentInteraction, ITracker tracker, [Frozen] IContactProfileProvider contactProfileProvider, [Frozen] IProfileProvider profileProvider, [Greedy] DemoController sut) { //TODO: Fix; //tracker.Interaction.Returns(currentInteraction); //tracker.Session.Returns(session); //var attachments = new Dictionary<string, object> //{ // ["KeyBehaviorCache"] = new Analytics.Tracking.KeyBehaviorCache(keyBehaviorCache) //}; //tracker.Contact.Attachments.Returns(attachments); //var fakeSite = new FakeSiteContext(new StringDictionary // { // {"mode", "edit"} // }) as SiteContext; //using (new SiteContextSwitcher(fakeSite)) //{ // using (new TrackerSwitcher(tracker)) // { // sut.ExperienceData().Should().BeOfType<ViewResult>().Which.Model.Should().BeOfType<EmptyResult>(); // } //} }
public void ID_ShouldReturnFromProvider(IContactProfileProvider provider, Guid expectedId) { provider.Contact.ContactId.Returns(expectedId); var model = new ContactInformation(provider); model.Id.Should().Be(expectedId); }
public void EndVisit_ShouldEndSession(IContactProfileProvider contact, IProfileProvider profile, [Substitute]ControllerContext ctx) { //arrange var controller = new DemoController(contact, profile); controller.ControllerContext = ctx; controller.EndVisit(); ctx.HttpContext.Session.Received(1).Abandon(); }
public void EndVisit_ShouldReturnRedirectToRoot(IContactProfileProvider contact, IProfileProvider profile, [Substitute]ControllerContext ctx) { //arrange var controller = new DemoController(contact, profile); controller.ControllerContext = ctx; controller.EndVisit().As<RedirectResult>().Url.Should().Be("/"); }
public void DemoContent_RenderingContextNotDerivedFromSpecificTemplate_ShouldThrowException([Content]Item ctxItem, IContactProfileProvider contact, IProfileProvider profile, ITracker tracker) { //arrange var controller = new DemoController(contact, profile); var context = new RenderingContext(); context.ContextItem = ctxItem; ContextService.Get().Push(context); using (new TrackerSwitcher(tracker)) { controller.Invoking(x => x.DemoContent()).ShouldThrow<InvalidDataSourceItemException>(); } }
public ContactInformation(IContactProfileProvider contactProfileProvider) { this.contactProfileProvider = contactProfileProvider; }
public void ShouldSetPreferredEmail([Frozen] IContactProfileProvider contactProfileProvider, [Greedy] ContactProfileService contactProfileService, string email, IEmailAddress emailAddress) { contactProfileService.SetPreferredEmail(emailAddress.SmtpAddress); contactProfileProvider.Emails.Entries[contactProfileProvider.Emails.Preferred].SmtpAddress.ShouldBeEquivalentTo(emailAddress.SmtpAddress); }
public void Identifier_ShouldReturnFromProvider(IContactProfileProvider provider, string expectedId) { provider.Contact.Identifiers.Identifier.Returns(expectedId); var model = new ContactInformation(provider); model.Identifier.Should().Be(expectedId); }
public VisitsRepository(IContactProfileProvider contactProfileProvider) { this.contactProfileProvider = contactProfileProvider; }
public PersonalInfoRepository(IContactProfileProvider contactProfileProvider) { this.contactProfileProvider = contactProfileProvider; }