• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NativePageType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NativePageType的典型用法代码示例。如果您正苦于以下问题:C# NativePageType类的具体用法?C# NativePageType怎么用?C# NativePageType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NativePageType类属于命名空间,在下文中一共展示了NativePageType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PageTypePropertyDefinitionLocator

        public void GivenTypeWithNestedPropertyGroups_GetPageTypePropertyDefinitions_ReturnsListWithSevenPropertyDefinitions()
        {
            PageTypePropertyDefinitionLocator definitionLocator = new PageTypePropertyDefinitionLocator();
            IPageType pageType = new NativePageType();
            Type pageTypeType = typeof(TestPageTypeWithPropertyGroups);
            IEnumerable<PageTypePropertyDefinition> propertyDefinitions = definitionLocator.GetPageTypePropertyDefinitions(pageType, pageTypeType);

            Assert.Equal(7, propertyDefinitions.Count());

            List<Defintion> defintions = new List<Defintion>
             {
                 new Defintion { EditCaption = "Property one", SortOrder = 100, Name = "LongStringProperty" },
                 new Defintion { EditCaption = "Image one - Image Url", SortOrder = 400, Name = "ImageOne-ImageUrl" },
                 new Defintion { EditCaption = "Image one - Alt text", SortOrder = 410, Name = "ImageOne-AltText" },
                 new Defintion { EditCaption = "Image two - Image Url", SortOrder = 500, Name = "ImageTwo-ImageUrl" },
                 new Defintion { EditCaption = "Image two - Alt text", SortOrder = 510, Name = "ImageTwo-AltText" },
                 new Defintion { EditCaption = "Image three - Image Url", SortOrder = 600, Name = "ImageThree-ImageUrl" },
                 new Defintion { EditCaption = "Image three - Alt text", SortOrder = 610, Name = "ImageThree-AltText" }
             };

            foreach (PageTypePropertyDefinition pageTypePropertyDefinition in propertyDefinitions)
            {
                Defintion defintion = defintions.Where(current => string.Equals(current.Name, pageTypePropertyDefinition.Name)).FirstOrDefault();

                Assert.True(defintion != null);

                Assert.Equal(pageTypePropertyDefinition.PageTypePropertyAttribute.SortOrder, defintion.SortOrder);
                Assert.Equal(pageTypePropertyDefinition.PageTypePropertyAttribute.EditCaption, defintion.EditCaption);
            }
        }
开发者ID:stenis,项目名称:Page-Type-Builder,代码行数:30,代码来源:PageTypePropertyLocatorTests.cs


示例2: CreatePageTypePropertyDefinition

 public static PageTypePropertyDefinition CreatePageTypePropertyDefinition()
 {
     string name = TestValueUtility.CreateRandomString();
     Type type = typeof(string);
     IPageType pageType = new NativePageType();
     PageTypePropertyAttribute attribute = new PageTypePropertyAttribute();
     return new PageTypePropertyDefinition(name, type, pageType, attribute);
 }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:8,代码来源:PageTypePropertyUpdaterTestsUtility.cs


示例3: typeof

 public void GivenTypeWithOnePageTypePropertyAttributeFromInterface_GetPageTypePropertyDefinitions_ReturnsListWithOnePropertyDefinition()
 {
     var type = typeof(TestPageTypeWithInterface);
     var pageType = new NativePageType();
     PageTypePropertyDefinitionLocator definitionLocator = new PageTypePropertyDefinitionLocator();
     IEnumerable<PageTypePropertyDefinition> propertyDefinitions = definitionLocator.GetPageTypePropertyDefinitions(pageType, type);
     Assert.Equal<int>(1, propertyDefinitions.Count());
 }
开发者ID:eriknordin,项目名称:Page-Type-Builder,代码行数:8,代码来源:PageTypePropertyLocatorTests.cs


示例4: WhenUpdatePageTypeCalled_CallsUpdateFilename

        public void WhenUpdatePageTypeCalled_CallsUpdateFilename()
        {
            PageTypeDefinition definition = PageTypeUpdaterTestsUtility.CreateBasicPageTypeDefinition();
            IPageType pageType = new NativePageType();
            PageTypeUpdater pageTypeUpdater = CreateFakePageTypeUpdaterWithUpdatePageTypeMethodHelperStubs();

            pageTypeUpdater.UpdatePageType(definition);

            pageTypeUpdater.AssertWasCalled(updater => updater.UpdateFilename(pageType, definition.Attribute));
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:10,代码来源:UpdatePageTypeMethodTests.cs


示例5: GivenNoNameSetInAttribute_WhenUpdatePageTypeCalled_UpdatesPageTypeNameWithName

        public void GivenNoNameSetInAttribute_WhenUpdatePageTypeCalled_UpdatesPageTypeNameWithName()
        {
            PageTypeDefinition definition = PageTypeUpdaterTestsUtility.CreateBasicPageTypeDefinition();
            IPageType pageType = new NativePageType();
            PageTypeUpdater pageTypeUpdater = CreatePageTypeUpdater();
            string name = definition.Type.Name;

            pageTypeUpdater.UpdateName(pageType, definition);

            Assert.Equal<string>(name, pageType.Name);
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:11,代码来源:UpdatePageTypeMethodTests.cs


示例6: GivenPageType_UpdatePageTypePropertyDefinitions_CallsGetPageTypePropertyDefinitions

        public void GivenPageType_UpdatePageTypePropertyDefinitions_CallsGetPageTypePropertyDefinitions()
        {
            List<PageTypePropertyDefinition> definitions = new List<PageTypePropertyDefinition>();
            PageTypePropertyUpdater pageTypePropertyUpdater = CreatePageTypePropertyUpdater(definitions);
            IPageType pageType = new NativePageType();
            PageTypeDefinition pageTypeDefinition = new PageTypeDefinition();

            pageTypePropertyUpdater.UpdatePageTypePropertyDefinitions(pageType, pageTypeDefinition);

            pageTypePropertyUpdater.PageTypePropertyDefinitionLocator.AssertWasCalled(
                locator => locator.GetPageTypePropertyDefinitions(
                               pageType, pageTypeDefinition.Type));
        }
开发者ID:osdezwart,项目名称:Page-Type-Builder,代码行数:13,代码来源:UpdatePageTypePropertyDefinitionsTests.cs


示例7: NativePageType

        public void GivenPageTypeWithPropertyAndCorrespondingPropertyDefition_GetExistingPropertyDefinition_ReturnsPageDefinition()
        {
            PageTypePropertyUpdater utility = PageTypePropertyUpdaterFactory.Create();
            IPageType pageType = new NativePageType();
            string name = TestValueUtility.CreateRandomString();
            Type type = typeof(string);
            PageTypePropertyAttribute attribute = new PageTypePropertyAttribute();
            PageTypePropertyDefinition pageTypePropertyDefinition = new PageTypePropertyDefinition(name, type, pageType, attribute);
            PageDefinition pageDefinition = new PageDefinition();
            pageDefinition.Name = name;
            pageType.Definitions.Add(pageDefinition);

            PageDefinition returnedPageDefinition = utility.GetExistingPageDefinition(pageType, pageTypePropertyDefinition);

            Assert.Equal<PageDefinition>(pageDefinition, returnedPageDefinition);
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:16,代码来源:GetExistingPageDefitionTests.cs


示例8: MockRepository

        public void GivenPageTypeWithNoGuidOrSpecifiedName_GetExistingPageType_ReturnsPageTypeReturnedFromPageTypeFactoryLoad()
        {
            MockRepository mockRepository = new MockRepository();
            PageTypeDefinition pageTypeDefinition = PageTypeUpdaterTestsUtility.CreateBasicPageTypeDefinition();
            PageTypeRepository fakePageTypeRepository = mockRepository.Stub<PageTypeRepository>();
            IPageType pageTypeFromFactory = new NativePageType();
            pageTypeFromFactory.ID = 1;
            fakePageTypeRepository.Expect(factory => factory.Load(pageTypeDefinition.Type.Name)).Return(pageTypeFromFactory);
            fakePageTypeRepository.Replay();
            PageTypeUpdater pageTypeUpdater = PageTypeUpdaterFactory.Create(
                PageTypeDefinitionLocatorFactory.Stub(), fakePageTypeRepository);

            IPageType returnedPageType = pageTypeUpdater.GetExistingPageType(pageTypeDefinition);

            fakePageTypeRepository.AssertWasCalled(factory => factory.Load(pageTypeDefinition.Type.Name));
            Assert.Equal<int>(pageTypeFromFactory.ID, returnedPageType.ID);
        }
开发者ID:joelabrahamsson,项目名称:Page-Type-Builder,代码行数:17,代码来源:GetExistingPageTypeTests.cs


示例9: AssemblyName

        public void GivenTypeWithOnePageTypePropertyAttribute_GetPageTypePropertyDefinitions_ReturnsListWithOnePropertyDefinition()
        {
            AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("TestAssembly"),
                                                                                            AssemblyBuilderAccess.RunAndSave);
            ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule("Module", "Module.dll");
            TypeBuilder typeBuilder = moduleBuilder.DefineType("PageTypeType");
            string propertyName = TestValueUtility.CreateRandomString();
            Type propertyType = typeof(string);
            PropertyBuilder propertyBuilder = typeBuilder.DefineProperty(propertyName, PropertyAttributes.None, propertyType, null);
            ConstructorInfo pageTypePropertyAttributeConstructor = typeof(PageTypePropertyAttribute).GetConstructor(new Type[0]);
            CustomAttributeBuilder customAttributeBuilder = new CustomAttributeBuilder(pageTypePropertyAttributeConstructor, new object[0]);
            propertyBuilder.SetCustomAttribute(customAttributeBuilder);
            Type type = typeBuilder.CreateType();
            IPageType pageType = new NativePageType();
            PageTypePropertyDefinitionLocator definitionLocator = new PageTypePropertyDefinitionLocator();

            IEnumerable<PageTypePropertyDefinition> propertyDefinitions = definitionLocator.GetPageTypePropertyDefinitions(pageType, type);

            Assert.Equal<int>(1, propertyDefinitions.Count());
        }
开发者ID:joelabrahamsson,项目名称:Page-Type-Builder,代码行数:20,代码来源:PageTypePropertyLocatorTests.cs


示例10: PageTypeDefinition

        public void GivenPageType_UpdatePageTypePropertyDefinitions_CallsPageTypePropertyUpdaterUpdatePageTypePropertyDefinitions()
        {
            PageTypeDefinition definition = new PageTypeDefinition();
            
            MockRepository fakes = new MockRepository();
            PageTypeUpdater pageTypeUpdater = PageTypeUpdaterFactory.Stub(fakes);
            IPageType pageType = new NativePageType();
            PageDefinitionSynchronizationEngine pageDefinitionSynchronizationEngine = PageDefinitionSynchronizationEngineFactory.Stub(fakes);
            pageDefinitionSynchronizationEngine.Stub(updater => updater.UpdatePageTypePropertyDefinitions(pageType, definition));
            pageDefinitionSynchronizationEngine.Replay();
            IPageTypeLocator pageTypeLocator = fakes.Stub<IPageTypeLocator>();
            pageTypeLocator.Stub(locator => locator.GetExistingPageType(definition)).Return(pageType);
            pageTypeLocator.Replay();
            List<PageTypeDefinition> definitions = new List<PageTypeDefinition> { definition };
            PageTypeSynchronizer synchronizer =
                PageTypeSynchronizerFactory.Create(pageDefinitionSynchronizationEngine, pageTypeLocator);
            synchronizer.PageTypeUpdater = pageTypeUpdater;
            synchronizer.UpdatePageTypePropertyDefinitions(definitions);

            pageDefinitionSynchronizationEngine.AssertWasCalled(updater => updater.UpdatePageTypePropertyDefinitions(pageType, definition));
        }
开发者ID:joelabrahamsson,项目名称:Page-Type-Builder,代码行数:21,代码来源:UpdatePageTypePropertyDefinitionsTests.cs


示例11: GivenPageType_UpdatePageTypePropertyDefinitions_CallsGetExistingPageDefinition

        public void GivenPageType_UpdatePageTypePropertyDefinitions_CallsGetExistingPageDefinition()
        {
            List<PageTypePropertyDefinition> definitions = new List<PageTypePropertyDefinition>();
            PageTypePropertyDefinition pageTypePropertyDefinition = PageTypePropertyUpdaterTestsUtility.CreatePageTypePropertyDefinition();
            definitions.Add(pageTypePropertyDefinition);
            PageTypePropertyUpdater pageTypePropertyUpdater = CreatePageTypePropertyUpdater(definitions);
            IPageType pageType = new NativePageType();
            PageTypeDefinition pageTypeDefinition = new PageTypeDefinition();
            pageTypePropertyUpdater.Stub(utility => utility.GetExistingPageDefinition(
                                                        pageType, pageTypePropertyDefinition)).Return(new PageDefinition());
            pageTypePropertyUpdater.Stub(
                utility => utility.UpdatePageDefinition(
                               Arg<PageDefinition>.Is.Anything, Arg<PageTypePropertyDefinition>.Is.Anything));
            pageTypePropertyUpdater.Replay();

            pageTypePropertyUpdater.UpdatePageTypePropertyDefinitions(pageType, pageTypeDefinition);

            pageTypePropertyUpdater.AssertWasCalled(
                utility => utility.GetExistingPageDefinition(
                               pageType, pageTypePropertyDefinition));
        }
开发者ID:osdezwart,项目名称:Page-Type-Builder,代码行数:21,代码来源:UpdatePageTypePropertyDefinitionsTests.cs


示例12: GivenPageTypeDefinition_AddPageTypesToResolver_AddsToResolver

        public void GivenPageTypeDefinition_AddPageTypesToResolver_AddsToResolver()
        {
            
            List<PageTypeDefinition> definitions = new List<PageTypeDefinition>();
            PageTypeDefinition definition = new PageTypeDefinition
                                                {
                                                    Type = typeof(string),
                                                    Attribute = new PageTypeAttribute()
                                                };
            definitions.Add(definition);
            IPageType pageType = new NativePageType();
            pageType.ID = 1;
            MockRepository fakes = new MockRepository();
            IPageTypeLocator pageTypeLocator = fakes.Stub<IPageTypeLocator>();
            pageTypeLocator.Stub(locator => locator.GetExistingPageType(definition)).Return(pageType);
            pageTypeLocator.Replay();
            PageTypeResolver resolver = new PageTypeResolver();
            PageTypeSynchronizer synchronizer = PageTypeSynchronizerFactory.Create(resolver, pageTypeLocator);

            synchronizer.AddPageTypesToResolver(definitions);

            Assert.Equal<Type>(definition.Type, resolver.GetPageTypeType(pageType.ID));
        }
开发者ID:joelabrahamsson,项目名称:Page-Type-Builder,代码行数:23,代码来源:AddPageTypesToResolverTests.cs


示例13: WhenUpdatePageTypeCalled_CallsUpdateFrame

        public void WhenUpdatePageTypeCalled_CallsUpdateFrame()
        {
            PageTypeAttribute attribute = new PageTypeAttribute();
            IPageType pageType = new NativePageType();
            PageTypeUpdater pageTypeUpdater = CreateFakePageTypeUpdaterWithUpdatePageTypeMethodHelperStubs();

            pageTypeUpdater.UpdateFrame(pageType, attribute);

            pageTypeUpdater.AssertWasCalled(updater => updater.UpdateFrame(pageType, attribute));
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:10,代码来源:UpdatePageTypeMethodTests.cs


示例14: NativePageType

        public void GivenNoDefaultVisibleInMenuInAttribute_UpdateDefaultVisibleInMenuCalled_SetsPageTypeDefaultVisibleInMenuToDefaultValue()
        {
            IPageType pageType = new NativePageType();
            pageType.DefaultVisibleInMenu = !PageTypeUpdater.DefaultDefaultVisibleInMenu;
            PageTypeUpdater pageTypeUpdater = CreatePageTypeUpdater();

            pageTypeUpdater.UpdateDefaultVisibleInMenu(pageType, new PageTypeAttribute());

            Assert.Equal<bool>(PageTypeUpdater.DefaultDefaultVisibleInMenu, pageType.DefaultVisibleInMenu);
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:10,代码来源:UpdatePageTypeMethodTests.cs


示例15: GivenValue_UpdateDefaultVisibleInMenu_UpdatesPageTypeDefaultVisibleInMenuWithValue

        public void GivenValue_UpdateDefaultVisibleInMenu_UpdatesPageTypeDefaultVisibleInMenuWithValue(bool defaultVisibleInMenu)
        {
            PageTypeDefinition definition = PageTypeUpdaterTestsUtility.CreateBasicPageTypeDefinition();
            definition.Attribute.DefaultVisibleInMenu = defaultVisibleInMenu;
            IPageType pageType = new NativePageType();
            PageTypeUpdater pageTypeUpdater = CreatePageTypeUpdater();

            pageTypeUpdater.UpdateDefaultVisibleInMenu(pageType, definition.Attribute);

            Assert.Equal<bool>(defaultVisibleInMenu, pageType.DefaultVisibleInMenu);
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:11,代码来源:UpdatePageTypeMethodTests.cs


示例16: WhenUpdatePageTypeCalls_CallsUpdateDefaultVisibleInMenu

        public void WhenUpdatePageTypeCalls_CallsUpdateDefaultVisibleInMenu()
        {
            PageTypeDefinition definition = PageTypeUpdaterTestsUtility.CreateBasicPageTypeDefinition();
            IPageType existingPageType = new NativePageType();
            PageTypeUpdater pageTypeUpdater = CreateFakePageTypeUpdaterWithUpdatePageTypeMethodHelperStubs();

            pageTypeUpdater.UpdatePageType(definition);

            pageTypeUpdater.AssertWasCalled(updater => updater.UpdateDefaultVisibleInMenu(existingPageType, definition.Attribute));
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:10,代码来源:UpdatePageTypeMethodTests.cs


示例17: PageTypeAttribute

        public void GivenAPageTypeAndANumberOfMinutes_WhenUpdateDefaultStopPublishOffsetIsCalled_ItUpdatesPageTypeDefaultStopPublishOffset(int defaultOffsetMinutes)
        {
            PageTypeAttribute attribute = new PageTypeAttribute();
            attribute.DefaultStopPublishOffsetMinutes = defaultOffsetMinutes;
            IPageType pageType = new NativePageType();
            pageType.DefaultStopPublishOffset = new TimeSpan(0, 0, 1, 0);
            PageTypeUpdater pageTypeUpdater = CreatePageTypeUpdater();

            pageTypeUpdater.UpdateDefaultStopPublishOffset(pageType, attribute);

            TimeSpan expectedOffset = new TimeSpan(0, 0, defaultOffsetMinutes, 0);
            Assert.Equal<TimeSpan>(expectedOffset, pageType.DefaultStopPublishOffset);
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:13,代码来源:UpdatePageTypeMethodTests.cs


示例18: GivenPageType_WhenUpdateDefaultPeerOrderRuleCalled_UpdatesPageTypeDefaultPeerOrderRule

        public void GivenPageType_WhenUpdateDefaultPeerOrderRuleCalled_UpdatesPageTypeDefaultPeerOrderRule(int defaultSortIndex)
        {
            PageTypeAttribute attribute = new PageTypeAttribute();
            attribute.DefaultSortIndex = defaultSortIndex;
            IPageType pageType = new NativePageType();
            pageType.DefaultPeerOrder = 1;
            PageTypeUpdater pageTypeUpdater = CreatePageTypeUpdater();

            pageTypeUpdater.UpdateDefaultPeerOrder(pageType, attribute);

            Assert.Equal<int>(defaultSortIndex, pageType.DefaultPeerOrder);
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:12,代码来源:UpdatePageTypeMethodTests.cs


示例19: GivenName_WhenUpdateDefaultNameCalled_UpdatesPageTypeDefaultPageName

        public void GivenName_WhenUpdateDefaultNameCalled_UpdatesPageTypeDefaultPageName(string defaultPageName)
        {
            PageTypeAttribute attribute = new PageTypeAttribute();
            attribute.DefaultPageName = defaultPageName;
            IPageType pageType = new NativePageType();
            pageType.DefaultPageName = TestValueUtility.CreateRandomString();
            PageTypeUpdater pageTypeUpdater = CreatePageTypeUpdater();

            pageTypeUpdater.UpdateDefaultPageName(pageType, attribute);

            Assert.Equal<string>(defaultPageName, pageType.DefaultPageName);
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:12,代码来源:UpdatePageTypeMethodTests.cs


示例20: GivenFilterSortOrder_WhenUpdatePageTypeCalled_UpdatesPageTypeDefaultChildOrderRule

        public void GivenFilterSortOrder_WhenUpdatePageTypeCalled_UpdatesPageTypeDefaultChildOrderRule(FilterSortOrder sortOrder)
        {
            PageTypeAttribute attribute = new PageTypeAttribute();
            attribute.DefaultChildSortOrder = sortOrder;
            IPageType pageType = new NativePageType();
            pageType.DefaultChildOrderRule = FilterSortOrder.PublishedAscending;
            PageTypeUpdater pageTypeUpdater = CreatePageTypeUpdater();

            pageTypeUpdater.UpdateDefaultChildOrderRule(pageType, attribute);

            Assert.Equal<FilterSortOrder>(sortOrder, pageType.DefaultChildOrderRule);
        }
开发者ID:andreasnico,项目名称:Page-Type-Builder,代码行数:12,代码来源:UpdatePageTypeMethodTests.cs



注:本文中的NativePageType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NativeWriter类代码示例发布时间:2022-05-24
下一篇:
C# NativePage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap