Esempio n. 1
0
        public void CreatePropertyWithoutSource_UsesCorrectTemplateAndInsertsAccessor()
        {
            var factoryProvider = new Mocks.FactoryProvider();

            BehaviorChainTemplateRegistry.RegisterTemplate(
                DefaultBehaviorChainTemplateKeys.Property,
                new BehaviorChainTemplate(factoryProvider)
                .Append(TestKey)
                .Append(PropertyBehaviorKeys.ValueAccessor, DefaultBehaviorState.DisabledWithoutFactory)
                );

            factoryProvider.BehaviorForProperty = Mock <IBehavior>();
            var expectedValueAccessor = Mock <IValueAccessorBehavior <string> >();

            var property = Factory.Property <string>(expectedValueAccessor);

            AssertBehavior(
                property,
                PropertyBehaviorKeys.ValueAccessor,
                actualAccessor => Assert.AreEqual(expectedValueAccessor, actualAccessor)
                );

            AssertBehavior(
                property,
                TestKey,
                actualBehavior => Assert.AreEqual(factoryProvider.BehaviorForProperty, actualBehavior)
                );
        }
 private static void RegisterCustomCommandTemplate()
 {
     BehaviorChainTemplateRegistry.RegisterTemplate(
         DefaultBehaviorChainTemplateKeys.CommandProperty,
         new BehaviorChainTemplate(CustomBehaviorFactoryProviders.CommandProperty)
         .Append(PropertyBehaviorKeys.ValueAccessor)
         .Append(CommandPropertyBehaviorKeys.WaitCursor)
         .Append(TestBehaviorKey)
         .Append(CommandPropertyBehaviorKeys.CommandExecutor, DefaultBehaviorState.DisabledWithoutFactory)
         .Append(PropertyBehaviorKeys.SourceAccessor, DefaultBehaviorState.DisabledWithoutFactory)
         );
 }
Esempio n. 3
0
 private static void RegisterPropertyTemplate()
 {
     BehaviorChainTemplateRegistry.RegisterTemplate(
         DefaultBehaviorChainTemplateKeys.Property,
         new BehaviorChainTemplate(BehaviorFactoryProviders.SimpleProperty)
         .Append(PropertyBehaviorKeys.DisplayValueAccessor)
         .Append(PropertyBehaviorKeys.UntypedValueAccessor)
         .Append(PropertyBehaviorKeys.PropertyPreloader, DefaultBehaviorState.Disabled)
         .Append(PropertyBehaviorKeys.Undo, DefaultBehaviorState.Disabled)
         .Append(PropertyBehaviorKeys.ValueValidationSource, DefaultBehaviorState.Disabled)
         .Append(PropertyBehaviorKeys.ChangeNotifier)
         .Append(PropertyBehaviorKeys.ValueAccessor, DefaultBehaviorState.DisabledWithoutFactory)
         .Append(PropertyBehaviorKeys.PropertyDescriptorProvider)
         );
 }
Esempio n. 4
0
 private static void RegisterCommandPropertyTemplate()
 {
     BehaviorChainTemplateRegistry.RegisterTemplate(
         DefaultBehaviorChainTemplateKeys.CommandProperty,
         new BehaviorChainTemplate(BehaviorFactoryProviders.CommandProperty)
         .Append(PropertyBehaviorKeys.DisplayValueAccessor)
         .Append(PropertyBehaviorKeys.UntypedValueAccessor)
         .Append(PropertyBehaviorKeys.PropertyPreloader, DefaultBehaviorState.Disabled)
         .Append(PropertyBehaviorKeys.ValueAccessor)
         .Append(CommandPropertyBehaviorKeys.WaitCursor)
         .Append(CommandPropertyBehaviorKeys.CommandExecutor, DefaultBehaviorState.DisabledWithoutFactory)
         .Append(PropertyBehaviorKeys.SourceAccessor, DefaultBehaviorState.DisabledWithoutFactory)
         .Append(PropertyBehaviorKeys.PropertyDescriptorProvider)
         );
 }
Esempio n. 5
0
 private static void RegisterViewModelTemplate()
 {
     BehaviorChainTemplateRegistry.RegisterTemplate(
         DefaultBehaviorChainTemplateKeys.ViewModel,
         new BehaviorChainTemplate(BehaviorFactoryProviders.ViewModel)
         .Append(ViewModelBehaviorKeys.LoadOrderController)
         .Append(ViewModelBehaviorKeys.ValidationResultAggregatorCache)
         .Append(ViewModelBehaviorKeys.ValidationResultAggregator)
         //.Append(ViewModelBehaviorKeys.FastValidationResultAggregator)
         .Append(ViewModelBehaviorKeys.ViewModelValidationSource, DefaultBehaviorState.Disabled)
         .Append(ViewModelBehaviorKeys.ValidationExecutor, DefaultBehaviorState.Disabled)
         .Append(ViewModelBehaviorKeys.TypeDescriptorProvider)
         .Append(ViewModelBehaviorKeys.UndoRoot, DefaultBehaviorState.Disabled)
         .Append(ViewModelBehaviorKeys.DeclarativeDependencies, DefaultBehaviorState.Disabled)
         );
 }
Esempio n. 6
0
 private static void RegisterViewModelWithSourcePropertyTemplate()
 {
     BehaviorChainTemplateRegistry.RegisterTemplate(
         DefaultBehaviorChainTemplateKeys.ViewModelPropertyWithSource,
         new BehaviorChainTemplate(BehaviorFactoryProviders.ViewModelProperty)
         .Append(PropertyBehaviorKeys.DisplayValueAccessor)
         .Append(PropertyBehaviorKeys.UntypedValueAccessor)
         .Append(PropertyBehaviorKeys.PropertyPreloader, DefaultBehaviorState.Disabled)
         .Append(PropertyBehaviorKeys.ValueInitializer)
         .Append(PropertyBehaviorKeys.Undo, DefaultBehaviorState.Disabled)
         .Append(PropertyBehaviorKeys.LazyRefresh)
         .Append(PropertyBehaviorKeys.ValueValidationSource, DefaultBehaviorState.Disabled)
         .Append(PropertyBehaviorKeys.DescendantsValidator)
         .Append(PropertyBehaviorKeys.ChangeNotifier)
         .Append(PropertyBehaviorKeys.ValueAccessor, DefaultBehaviorState.DisabledWithoutFactory)
         .Append(PropertyBehaviorKeys.SourceAccessor, DefaultBehaviorState.DisabledWithoutFactory)
         .Append(PropertyBehaviorKeys.ValueFactory)
         .Append(PropertyBehaviorKeys.PropertyDescriptorProvider)
         );
 }