public ValidatePageTypeDefinitions ( IEnumerable |
||
pageTypeDefinitions | IEnumerable |
|
Résultat | void |
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 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 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); }