Ejemplo n.º 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();
 }
Ejemplo n.º 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>();
   }
 }
Ejemplo n.º 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);
   }
 }
Ejemplo n.º 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>();
   }
 }
Ejemplo n.º 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();
   }
 }
Ejemplo n.º 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>();
      }
    }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 9
0
 public DemoController(IContactProfileProvider contactProfileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
 }
Ejemplo n.º 10
0
 public ContactProfileService(IContactProfileProvider contactProfileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
 }
Ejemplo n.º 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>();
      }
    }
Ejemplo n.º 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());
 }
Ejemplo n.º 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>();
                }
            }
        }
Ejemplo n.º 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>();
            //  }
            //}
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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("/");
 }
Ejemplo n.º 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>();
   }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 22
0
 public VisitsRepository(IContactProfileProvider contactProfileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
 }
Ejemplo n.º 23
0
 public ContactProfileService(IContactProfileProvider contactProfileProvider)
 {
     this.contactProfileProvider = contactProfileProvider;
 }
Ejemplo n.º 24
0
 public VisitsRepository(IContactProfileProvider contactProfileProvider)
 {
     this.contactProfileProvider = contactProfileProvider;
 }
Ejemplo n.º 25
0
 public PersonalInfoRepository(IContactProfileProvider contactProfileProvider)
 {
   this.contactProfileProvider = contactProfileProvider;
 }
Ejemplo n.º 26
0
 public ContactInformation(IContactProfileProvider contactProfileProvider)
 {
     this.contactProfileProvider = contactProfileProvider;
 }