Exemple #1
0
        /// <summary>
        ///   Makes the behavior execute only if the condition against a service
        ///   in the underlying IoC container is true
        /// </summary>
        /// <typeparam name = "T"></typeparam>
        /// <param name = "condition"></param>
        public void ConditionByService <T>(Func <T, bool> condition)
        {
            var description = "By Service:  Func<{0}, bool>".ToFormat(typeof(T).Name);

            Trace(new ConditionAdded(description));
            _conditionalDef = ConditionalObjectDef.ForService(condition);
        }
        public void for_service_negative()
        {
            var theService = new Service()
            {
                IsTrue = false
            };

            theContainer.Inject(theService);

            var def = ConditionalObjectDef.ForService <Service>(x => x.IsTrue);

            build(def).ShouldExecute().ShouldBeFalse();
        }
Exemple #3
0
 /// <summary>
 /// Makes the behavior execute only if the condition against a service
 /// in the underlying IoC container is true
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="condition"></param>
 public void ConditionByService <T>(Func <T, bool> condition)
 {
     _conditionalDef = ConditionalObjectDef.ForService(condition);
 }