本文整理汇总了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);
}
}
示例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);
}
示例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());
}
示例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));
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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());
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}