public void GivenDefinition_ValidatePageTypeDefinitions_CallsValidatorsValidatePageTypeDefinitionsMethod()
        {
            List <PageTypeDefinition>   definitions         = new List <PageTypeDefinition>();
            PageTypeSynchronizer        synchronizer        = CreateSynchronizer();
            MockRepository              fakes               = new MockRepository();
            PageTypeDefinitionValidator definitionValidator = fakes.Stub <PageTypeDefinitionValidator>((PageDefinitionTypeMapper)null);

            definitionValidator.Stub(validator => validator.ValidatePageTypeDefinitions(definitions));
            definitionValidator.Replay();
            synchronizer.PageTypeDefinitionValidator = definitionValidator;

            synchronizer.ValidatePageTypeDefinitions(definitions);

            definitionValidator.AssertWasCalled(validator => validator.ValidatePageTypeDefinitions(definitions));
        }
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));
        }
Exemplo n.º 3
0
        public void GivenListOfPageTypeDefinitions_ValidatePageTypeDefinitions_ValidatesEachPageType()
        {
            MockRepository            fakes       = new MockRepository();
            List <PageTypeDefinition> definitions = new List <PageTypeDefinition>();
            PageTypeDefinition        definition  = new PageTypeDefinition
            {
                Type      = typeof(TypedPageData),
                Attribute = new PageTypeAttribute()
            };

            definitions.Add(definition);
            PageTypeDefinitionValidator definitionValidator = fakes.PartialMock <PageTypeDefinitionValidator>((PageDefinitionTypeMapper)null);

            definitionValidator.Stub(validator => validator.ValidatePageTypeDefinition(definition, definitions));
            definitionValidator.Replay();

            definitionValidator.ValidatePageTypeDefinitions(definitions);

            definitionValidator.AssertWasCalled(validator => validator.ValidatePageTypeDefinition(definition, definitions));
        }