Example #1
0
        public static IRule <T> That <T>(this IBeforeRule <T> beforeRule, bool condition, Exception exception = null)
        {
            var realBefore = (IRealBeforeRule <T>)beforeRule;

            return(realBefore.CombineWith(() => condition ? null : exception ?? Exceptions.GetDefaultException()));
        }
Example #2
0
        public static IBeforeRule <TNew> WithContext <TOld, TNew>(this IBeforeRule <TOld> beforeRule, TNew context)
        {
            var realBeforeRule = (IRealBeforeRule <TOld>)beforeRule;

            return(new ContextSwitcher <TOld, TNew>(realBeforeRule, context));
        }
Example #3
0
 public FluentEnsureTests()
 {
     _ensure = FluentEnsure.StartEnsure();
 }