public void Constructor_SetsPageDefinitionTypeMapperProperty() { PageDefinitionTypeMapper mapper = new PageDefinitionTypeMapper(null); PageTypeDefinitionValidator pageTypeValidator = new PageTypeDefinitionValidator(mapper); Assert.NotNull(pageTypeValidator.PropertiesValidator.PageDefinitionTypeMapper); }
public void GivenDefinitionNameLongerThan50Chars_ValidatePageTypeDefinitions_ThrowsException() { List<PageTypeDefinition> definitions = new List<PageTypeDefinition>(); PageTypeDefinition invalidTypeDefinition = new PageTypeDefinition { Type = typeof(TypedPageData), Attribute = new PageTypeAttribute() { Name = "123456789123456789123456789123456789123456789123456" } }; definitions.Add(invalidTypeDefinition); PageTypeDefinitionValidator definitionValidator = new PageTypeDefinitionValidator(null); Exception exception = Record.Exception( () => definitionValidator.ValidatePageTypeDefinitions(definitions)); Assert.NotNull(exception); Type exceptionType = exception.GetType(); Assert.Equal<Type>(typeof(PageTypeBuilderException), exceptionType); }
public PageTypeSynchronizer(IPageTypeDefinitionLocator pageTypeDefinitionLocator, PageTypeBuilderConfiguration configuration, PageTypePropertyUpdater pageTypePropertyUpdater, PageTypeDefinitionValidator pageTypeDefinitionValidator, PageTypeResolver pageTypeResolver, IPageTypeLocator pageTypeLocator, PageTypeUpdater pageTypeUpdater, TabDefinitionUpdater tabDefinitionUpdater, TabLocator tabLocator) { _configuration = configuration; PageTypeResolver = pageTypeResolver; TabLocator = tabLocator; TabDefinitionUpdater = tabDefinitionUpdater; _pageTypeDefinitions = pageTypeDefinitionLocator.GetPageTypeDefinitions(); PageTypeUpdater = pageTypeUpdater; PageTypePropertyUpdater = pageTypePropertyUpdater; PageTypeDefinitionValidator = pageTypeDefinitionValidator; _pageTypeLocator = pageTypeLocator; }
public PageTypeSynchronizer(IPageTypeDefinitionLocator pageTypeDefinitionLocator, PageTypeBuilderConfiguration configuration, PageDefinitionSynchronizationEngine pageDefinitionSynchronizationEngine, PageTypeDefinitionValidator pageTypeDefinitionValidator, PageTypeResolver pageTypeResolver, IPageTypeLocator pageTypeLocator, PageTypeUpdater pageTypeUpdater, TabDefinitionUpdater tabDefinitionUpdater, TabLocator tabLocator, GlobalPropertySettingsSynchronizer globalPropertySettingsSynchronizer, IHooksHandler hooksHandler) { _configuration = configuration; this.pageTypeResolver = pageTypeResolver; TabLocator = tabLocator; TabDefinitionUpdater = tabDefinitionUpdater; _pageTypeDefinitions = pageTypeDefinitionLocator.GetPageTypeDefinitions(); PageTypeUpdater = pageTypeUpdater; PageDefinitionSynchronizationEngine = pageDefinitionSynchronizationEngine; PageTypeDefinitionValidator = pageTypeDefinitionValidator; _pageTypeLocator = pageTypeLocator; this.globalPropertySettingsSynchronizer = globalPropertySettingsSynchronizer; this.hooksHandler = hooksHandler; }
public void GivenDefinitionWithTypeThatDoesNotInheritFromTypedPageData_ValidatePageTypeDefinitions_ThrowsException() { List<PageTypeDefinition> definitions = new List<PageTypeDefinition>(); PageTypeDefinition invalidTypeDefinition = new PageTypeDefinition { Type = typeof(PageData), Attribute = new PageTypeAttribute() }; definitions.Add(invalidTypeDefinition); PageTypeDefinitionValidator definitionValidator = new PageTypeDefinitionValidator(null); Exception exception = Record.Exception( () => definitionValidator.ValidatePageTypeDefinitions(definitions)); Assert.NotNull(exception); Type exceptionType = exception.GetType(); Assert.Equal<Type>(typeof(PageTypeBuilderException), exceptionType); }
public void GivenPageTypeDefinitionWithUndefinedTypeInAllowedPageTypes_ValidatePageTypeDefinition_ThrowsException() { PageTypeDefinition definition = new PageTypeDefinition { Type = typeof(TypedPageData), Attribute = new PageTypeAttribute { AvailablePageTypes = new[] { typeof(TestPageType) } } }; List<PageTypeDefinition> allPageTypes = new List<PageTypeDefinition>(); PageTypeDefinitionValidator validator = new PageTypeDefinitionValidator(null); Exception exception = Record.Exception(() => validator.ValidatePageTypeDefinition(definition, allPageTypes)); Assert.NotNull(exception); }
public void GivenTwoPageTypesWithSameNameAndNoGuid_ValidatePageTypeDefinitions_ThrowsException() { List<PageTypeDefinition> definitions = new List<PageTypeDefinition>(); PageTypeDefinition validTypeDefinition = new PageTypeDefinition { Type = typeof(TypedPageData), Attribute = new PageTypeAttribute() }; definitions.Add(validTypeDefinition); definitions.Add(validTypeDefinition); PageTypeDefinitionValidator definitionValidator = new PageTypeDefinitionValidator(null); Exception exception = Record.Exception(() => definitionValidator.ValidatePageTypeDefinitions(definitions)); Assert.NotNull(exception); }
public void GivenTypesThatInheritFromTypedPageData_ValidatePageTypeDefinitions_DoesNotThrowException() { List<PageTypeDefinition> definitions = new List<PageTypeDefinition>(); PageTypeDefinition validTypeDefinition = new PageTypeDefinition { Type = typeof(TypedPageData), Attribute = new PageTypeAttribute() }; definitions.Add(validTypeDefinition); PageTypeDefinitionValidator definitionValidator = new PageTypeDefinitionValidator(null); definitionValidator.ValidatePageTypeDefinitions(definitions); }