Inheritance: SitecoreController
Esempio n. 1
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);
   }
 }
Esempio 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>();
   }
 }
Esempio n. 3
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();
   }
 }
Esempio 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>();
   }
 }
Esempio n. 5
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>();
      }
    }
Esempio n. 6
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>();
      }
    }
Esempio n. 7
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();
 }
Esempio n. 8
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("/");
 }
Esempio n. 9
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>();
   }
 }