Beispiel #1
0
        public static string PrepareFBValue(int num)
        {
            var rangeValid = new RangeValidator();
            var fbNumber = new FBNumber();
            fbNumber.chkFBNumber = num;

            string returnValue = rangeValid.DetermineNumberLabel(fbNumber);

            return returnValue;
        }
        public string ValidateDivisors(FBNumber fbNumber)
        {
            if(fbNumber.chkFBNumber > 0)
            {
                foreach (var numberDivisorValidation in DivisionRules)
                {
                    if(numberDivisorValidation.Key.Validate(fbNumber))
                    {
                        numberLabel = numberDivisorValidation.Value;
                        break;
                    }

                }

            }

            return numberLabel;
        }
Beispiel #3
0
 public string DetermineNumberLabel(FBNumber fbNumber)
 {
     if(fbNumber.chkFBNumber >= 1 && fbNumber.chkFBNumber < 101)
     {
         instance = returnBasicRangeLabel(fbNumber.chkFBNumber);
     }
     else if (fbNumber.chkFBNumber > 100 && fbNumber.chkFBNumber < 201)
     {
         instance = returnMidRangeLabel(fbNumber.chkFBNumber);
     }
     else if (fbNumber.chkFBNumber > 200 && fbNumber.chkFBNumber < 1001)
     {
         instance = returnTopRangeLabel(fbNumber.chkFBNumber);
     }
     else
     {
         var ex = new Exception("Value Out of Range");
         throw ex;
     }
     return instance;
 }
 public bool Validate(FBNumber fbNumber)
 {
     if (fbNumber.chkFBNumber % 5 == 0)
     {
         return true;
     }
     return false;
 }