Пример #1
0
        public void DemoContent_RenderingContextNotDerivedFromSpecificTemplate_ShouldThrowException([Greedy] DemoController sut, [Modest] RenderingContext context, Item ctxItem)
        {
            context.ContextItem = ctxItem;
            ContextService.Get().Push(context);

            sut.Invoking(x => x.DemoContent()).ShouldThrow <InvalidDataSourceItemException>();
        }
Пример #2
0
 public void DemoContent_RenderingContextItemNotInitialized_ShouldThrowException(
     [Greedy] DemoController sut,
     [Modest] RenderingContext context)
 {
     ContextService.Get().Push(context);
     sut.Invoking(x => x.DemoContent()).ShouldThrow <InvalidDataSourceItemException>();
 }
Пример #3
0
 public void DemoContent_RenderingContextNotDerivedFromSpecificTemplate_ShouldThrowException([Greedy] DemoController sut, Item ctxItem)
 {
     using (RenderingContext.EnterContext(new Rendering(), ctxItem))
     {
         sut.Invoking(x => x.DemoContent()).ShouldThrow <InvalidDataSourceItemException>();
     }
 }
Пример #4
0
 public void DemoContent_RenderingContextItemNotInitialized_ShouldThrowException([Greedy] DemoController sut)
 {
     using (RenderingContext.EnterContext(new Rendering()))
     {
         sut.Invoking(x => x.DemoContent()).ShouldThrow <InvalidDataSourceItemException>();
     }
 }
Пример #5
0
 public void DemoContent_RenderingContextNotDerivedFromSpecificTemplate_ShouldThrowException(Db db, [Substitute] Sitecore.Mvc.Presentation.PageContext pageContext, [Frozen] IDemoStateService demoState, [Greedy] DemoController sut, Item ctxItem)
 {
     pageContext.Database.Returns(db.Database);
     Sitecore.Mvc.Common.ContextService.Get().Push(pageContext);
     demoState.IsDemoEnabled.Returns(true);
     using (RenderingContext.EnterContext(new Rendering(), ctxItem))
     {
         sut.Invoking(x => x.DemoContent()).Should().Throw <InvalidDataSourceItemException>();
     }
 }
Пример #6
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>();
            }
        }
Пример #7
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>();
            }
        }