当前位置: 首页>>代码示例>>C#>>正文


C# NativePageType类代码示例

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


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


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