示例#1
0
 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();
 }
示例#2
0
 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>();
   }
 }
示例#3
0
 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);
   }
 }
示例#4
0
 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>();
   }
 }
示例#5
0
 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();
   }
 }
示例#6
0
    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>();
      }
    }
示例#7
0
 public void EngagementValue_ShouldReturnFromProvider(IContactProfileProvider provider, int number)
 {
   provider.Contact.System.Value.Returns(number);
   var model = new ContactInformation(provider);
   model.EngagementValue.Should().Be(number);
 }
示例#8
0
 public void NoOfVisits_ShouldReturnFromProvider(IContactProfileProvider provider, int number)
 {
   provider.Contact.System.VisitCount.Returns(number);
   var model = new ContactInformation(provider);
   model.NoOfVisits.Should().Be(number);
 }
示例#9
0
 public DemoController(IContactProfileProvider contactProfileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
 }
示例#10
0
 public ContactProfileService(IContactProfileProvider contactProfileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
 }
示例#11
0
    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>();
      }
    }
示例#12
0
 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());
 }
示例#13
0
        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>();
                }
            }
        }
示例#14
0
        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>();
            //  }
            //}
        }
示例#15
0
 public void ID_ShouldReturnFromProvider(IContactProfileProvider provider, Guid expectedId)
 {
   provider.Contact.ContactId.Returns(expectedId);
   var model = new ContactInformation(provider);
   model.Id.Should().Be(expectedId);
 }
示例#16
0
 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();
 }
示例#17
0
 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("/");
 }
示例#18
0
 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>();
   }
 }
示例#19
0
 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);
 }
示例#21
0
 public void Identifier_ShouldReturnFromProvider(IContactProfileProvider provider, string expectedId)
 {
   provider.Contact.Identifiers.Identifier.Returns(expectedId);
   var model = new ContactInformation(provider);
   model.Identifier.Should().Be(expectedId);
 }
示例#22
0
 public VisitsRepository(IContactProfileProvider contactProfileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
 }
示例#23
0
 public ContactProfileService(IContactProfileProvider contactProfileProvider)
 {
     this.contactProfileProvider = contactProfileProvider;
 }
 public VisitsRepository(IContactProfileProvider contactProfileProvider)
 {
     this.contactProfileProvider = contactProfileProvider;
 }
示例#25
0
 public PersonalInfoRepository(IContactProfileProvider contactProfileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
 }
示例#26
0
 public ContactInformation(IContactProfileProvider contactProfileProvider)
 {
     this.contactProfileProvider = contactProfileProvider;
 }