Пример #1
0
        public void ComponentId()
        {
            IComponentPresentation cp    = ComponentPresentationFactory.GetComponentPresentation("", "componentlink");
            TestViewModelA         model = ViewModelFactory.BuildViewModel(cp) as TestViewModelA;

            Assert.IsNotNull(model.Id, "ComponentId is not set");
        }
Пример #2
0
        public void PageId()
        {
            IPage         page  = PageFactory.FindPage("/page-which-matches-a-model");
            TestPageModel model = ViewModelFactory.BuildViewModel(page) as TestPageModel;

            Assert.IsNotNull(model.PageId, "PageId is not set");
        }
Пример #3
0
        public void MapConcreteLink()
        {
            IComponentPresentation cp = ComponentPresentationFactory.GetComponentPresentation("", "componentlink");

            Assert.IsNotNull(cp);

            IViewModel vm = ViewModelFactory.BuildViewModel(cp);

            Assert.IsNotNull(vm);

            TestViewModelB b = ((TestViewModelA)vm).ConcreteLink[0];

            Assert.IsNotNull(b);

            Assert.IsTrue(b.Heading == "some heading");
        }
Пример #4
0
        public void MapConcreteKeywordField()
        {
            IComponentPresentation cp = ComponentPresentationFactory.GetComponentPresentation("", "keyword");

            Assert.IsNotNull(cp);

            KeywordContainingModel vm = ViewModelFactory.BuildViewModel(cp) as KeywordContainingModel;

            Assert.IsNotNull(vm);

            KeywordModel km = vm.ConcreteKeyword;

            Assert.IsNotNull(km);

            Assert.IsTrue(km.Heading == "some heading");
        }
Пример #5
0
        public void MapAbstractEmbeddedField()
        {
            IComponentPresentation cp = ComponentPresentationFactory.GetComponentPresentation("", "embedded");

            Assert.IsNotNull(cp);

            EmbeddingModel vm = ViewModelFactory.BuildViewModel(cp) as EmbeddingModel;

            Assert.IsNotNull(vm);

            EmbeddedModel em = vm.Embedded as EmbeddedModel;

            Assert.IsNotNull(em);

            Assert.IsTrue(em.Heading == "some heading");
        }
Пример #6
0
        public void KeywordIdAsTcmUri()
        {
            IComponentPresentation cp = ComponentPresentationFactory.GetComponentPresentation("", "keyword");

            Assert.IsNotNull(cp);

            KeywordContainingModel vm = ViewModelFactory.BuildViewModel(cp) as KeywordContainingModel;

            Assert.IsNotNull(vm);

            KeywordModel km = vm.ConcreteKeyword;

            Assert.IsNotNull(km);

            Assert.IsNotNull(km.KeywordId, "KeywordId is not set");
        }
Пример #7
0
        public void MapComponentId()
        {
            IComponentPresentation cp = ComponentPresentationFactory.GetComponentPresentation("", "componentId");

            Assert.IsNotNull(cp);

            IViewModel vm = ViewModelFactory.BuildViewModel(cp);

            Assert.IsNotNull(vm);

            TestViewModelA b = (TestViewModelA)vm;

            Assert.IsNotNull(b);

            Assert.IsTrue(b.Id.ItemId == 8975);
            Assert.IsTrue(b.Id.PublicationId == 5);
        }
Пример #8
0
        public void MapFieldsIgnoreCase()
        {
            IComponentPresentation cp = ComponentPresentationFactory.GetComponentPresentation("", "componentIgnoreCase");

            Assert.IsNotNull(cp);

            //ViewModelFactory.LoadViewModels();
            IViewModel vm = ViewModelFactory.BuildViewModel(cp);

            Assert.IsNotNull(vm);


            TestViewModelB b = ((TestViewModelA)vm).ConcreteLink[0];

            Assert.IsNotNull(b);

            /// Assert.IsTrue(b.Heading == "some heading");
        }