public void AddBehavior(IBehavior behaviorInstance, BehaviorKey key = null)
        {
            string keyString = String.Format(
                "{0} (manually configured)",
                TypeService.GetFriendlyTypeName(behaviorInstance)
                );

            key = key ?? new BehaviorKey(keyString);

            Configuration.ViewModelConfiguration.Append(key, behaviorInstance);
            Configuration.ViewModelConfiguration.Enable(key, behaviorInstance);
        }
            ISinglePropertyBehaviorBuilder <TVM, TDescriptor, TValue> ISinglePropertyBehaviorBuilder <TVM, TDescriptor, TValue> .PrependBehavior(
                IBehavior behaviorInstance,
                BehaviorKey key
                )
            {
                string keyString = String.Format(
                    "{0} (manually configured)",
                    TypeService.GetFriendlyTypeName(behaviorInstance)
                    );

                key = key ?? new BehaviorKey(keyString);

                _propertyConfiguration.Prepend(key, behaviorInstance);
                _propertyConfiguration.Enable(key, behaviorInstance);
                return(this);
            }
            public string ToString(string details)
            {
                var ownerPostfix = Owner != null && Owner != TargetVM?
                                   String.Format(" of {0}", Owner) :
                                       String.Empty;

                var target = TargetCollection != null?
                             TypeService.GetFriendlyTypeName(TargetCollection) :
                                 String.Format("{0}", TargetVM);

                var targetWithProperty = TargetProperty != null?
                                         String.Format("{0}.{1}", target, TargetProperty) :
                                             String.Format("{0}", target);

                var validatorPostfix = ValidatorKey != null?
                                       String.Format(" by {0}", ValidatorKey) :
                                           String.Empty;

                var detailsPostfix = details != null?
                                     String.Format(" ({0})", details) :
                                         String.Empty;

                return(String.Format("{0} for {1}{2}{3}{4}", Type, targetWithProperty, ownerPostfix, validatorPostfix, detailsPostfix));
            }
 public void GetFriendlyTypeName_OfNull_ReturnsDescriptiveString()
 {
     Assert.AreEqual("<NULL>", TypeService.GetFriendlyTypeName(null));
 }
        public void GetFriendlyTypeName_OfInstance_ReturnsTypeName()
        {
            var instance = new Object();

            Assert.AreEqual("Object", TypeService.GetFriendlyTypeName(instance));
        }