/// <summary> /// >10 && <=100 /// </summary> /// <param name="number"></param> /// <returns></returns> private static RulesWithSubCondition <int> Between11And100(int number, IRule <int> Between101And200) { var stopAt100 = new StopRule <int>(100); var whenEqualTo60 = new ResolveAndRunNextRule <int>(() => number == 60, () => 60, stopAt100); var whenEqualTo50 = new ResolveAndRunNextRule <int>(() => number == 50, () => 50, stopAt100); var greaterThan10LessThan100 = new RulesWithSubCondition <int>(new IRule <int>[] { whenEqualTo50, whenEqualTo60, stopAt100 }, () => number <= 100, () => 100, Between101And200); return(greaterThan10LessThan100); }
/// <summary> /// >=1 && <=10 /// </summary> /// <param name="number"></param> /// <param name="greaterThan10LessThan100"></param> /// <returns></returns> private static RulesWithSubCondition <int> Between1And10(int number, RulesWithSubCondition <int> greaterThan10LessThan100) { var stopAt10 = new StopRule <int>(10); var between1And5 = new ResolveAndRunNextRule <int>(() => number >= 1 && number < 5, () => 1, stopAt10); var between5And9 = new ResolveAndRunNextRule <int>(() => number > 4 && number <= 9, () => 9, stopAt10); var return0WhenLessThan10 = new ResolveAndRunNextRule <int>(() => number <= 10, () => 10, greaterThan10LessThan100); var valueLessThan10Rule = new RulesWithSubCondition <int>(new IRule <int>[] { between1And5, between5And9 }, () => number == 10, () => 10, return0WhenLessThan10); return(valueLessThan10Rule); }