Exemplo n.º 1
0
        public void GivenPageTypeDefinitionWithDuplicatesInAllowedPageTypes_ValidatePageTypeDefinition_ThrowsException()
        {
            PageTypeDefinition definition = new PageTypeDefinition
            {
                Type      = typeof(TypedPageData),
                Attribute = new PageTypeAttribute
                {
                    AvailablePageTypes = new [] { typeof(TestPageType), typeof(TestPageType) }
                }
            };
            PageTypeDefinitionValidator validator = new PageTypeDefinitionValidator(null);

            Exception exception = Record.Exception(() => validator.ValidatePageTypeDefinition(definition, null));

            Assert.NotNull(exception);
        }
Exemplo n.º 2
0
        public void ValidatePageTypeDefinition_ValidatesProperties()
        {
            PageTypeDefinition          pageTypeDefinition = new PageTypeDefinition();
            MockRepository              fakes             = new MockRepository();
            PageTypeDefinitionValidator pageTypeValidator = fakes.PartialMock <PageTypeDefinitionValidator>((PageDefinitionTypeMapper)null);

            pageTypeValidator.Stub(validator => validator.ValidateInheritsFromBasePageType(pageTypeDefinition));
            pageTypeValidator.Stub(validator => validator.ValidateAvailablePageTypes(pageTypeDefinition, null));
            pageTypeValidator.Stub(validator => validator.ValidateNameLength(pageTypeDefinition));
            pageTypeValidator.Replay();
            pageTypeValidator.PropertiesValidator = fakes.Stub <PageTypeDefinitionPropertiesValidator>((PageDefinitionTypeMapper)null);
            pageTypeValidator.PropertiesValidator.Stub(validator => validator.ValidatePageTypeProperties(pageTypeDefinition));
            pageTypeValidator.PropertiesValidator.Replay();

            pageTypeValidator.ValidatePageTypeDefinition(pageTypeDefinition, null);

            pageTypeValidator.PropertiesValidator.AssertWasCalled(validator => validator.ValidatePageTypeProperties(pageTypeDefinition));
        }