Exemplo n.º 1
0
        /// <summary>
        /// Routes Integers by scrubbing types
        /// </summary>
        /// <param name="property"></param>
        /// <param name="cleanDataInstance"></param>
        /// <param name="scrubType"></param>
        /// <returns></returns>
        private object RouteIntegerType()
        {
            var propAttribute = _currentProperty.GetCustomAttribute(typeof(ScrubInteger));

            if (propAttribute != null)
            {
                ScrubInteger    atr           = propAttribute as ScrubInteger;
                IntegerScrubber attrScrubType = atr.scrubber;

                if (atr.start > int.MinValue && atr.end > int.MinValue && atr.end > atr.start)
                {
                    return(Faker.RandomNumber.Next(atr.start, atr.end));
                }

                switch (attrScrubType)
                {
                case IntegerScrubber.Zip:
                    return(Convert.ToInt32(Faker.Address.ZipCode().Replace("-", string.Empty)));

                default:
                    return(Faker.RandomNumber.Next(10000000, 99999999));
                }
            }
            else
            {
                return(Faker.RandomNumber.Next(10000000, 99999999));
            }
        }
Exemplo n.º 2
0
 public ScrubInteger(IntegerScrubber scrubber)
 {
     this.scrubber = scrubber;
 }