Esempio n. 1
0
        /// <summary>
        /// Generates a valid value taking into account only the <see cref="IPropRule"/>s. I.e. any <see cref="InterPropRule"/>s
        /// will not be taken into account. The <see cref="IValidValueGeneratorNumeric"/>'s methods are used
        /// by the BOTestFactory to create valid values taking into account InterPropRules
        /// </summary>
        /// <returns></returns>
        public override object GenerateValidValue()
        {
            CreateSampleValues();

            var    randomPos   = RandomValueGen.GetRandomInt(0, SampleValues.Count - 1);
            object sampleValue = SampleValues[randomPos];

            if (this.SingleValueDef.PropertyType != typeof(string))
            {
                var typeConverter = TypeDescriptor.GetConverter(SingleValueDef.PropertyType);
                if (typeConverter != null)
                {
                    if (typeConverter.CanConvertTo(SingleValueDef.PropertyType))
                    {
                        sampleValue = typeConverter.ConvertTo(sampleValue, SingleValueDef.PropertyType);
                    }
                }
            }
            return(sampleValue);
        }
        private string GenerateValidValueTyped()
        {
            PropRuleString propRule = base.GetPropRule <PropRuleString>();

            return((propRule == null) ? RandomValueGen.GetRandomString() : RandomValueGen.GetRandomString(propRule.MinLength, propRule.MaxLength));
        }
Esempio n. 3
0
 /// <summary>
 /// Generates a valid value taking into account only the <see cref="IPropRule"/>s. I.e. any <see cref="InterPropRule"/>s
 /// will not be taken into account. The <see cref="IValidValueGeneratorNumeric"/>'s methods are used
 /// by the BOTestFactory to create valid values taking into account InterPropRules
 /// </summary>
 /// <returns></returns>
 public override object GenerateValidValue()
 {
     return(RandomValueGen.GetRandomBoolean());
 }
 private static short GetMinValue(IPropRuleComparable <short> propRule, short?overridingMinValue)
 {
     return(RandomValueGen.GetMinValue(propRule, overridingMinValue));
 }
 /// <summary>
 /// Generates a valid value taking into account only the <see cref="IPropRule"/>s. I.e. any <see cref="InterPropRule"/>s
 /// will not be taken into account. The <see cref="IValidValueGeneratorNumeric"/>'s methods are used
 /// by the BOTestFactory to create valid values taking into account InterPropRules
 /// </summary>
 /// <returns></returns>
 public override object GenerateValidValue()
 {
     return(RandomValueGen.GetRandomEnum(base.SingleValueDef.PropertyType));
 }
 private static int GetMaxValue(IPropRuleComparable <int> propRule, int?overridingMaxValue)
 {
     return(RandomValueGen.GetMaxValue(propRule, overridingMaxValue));
 }
Esempio n. 7
0
 private static double GetMinValue(IPropRuleComparable <double> propRule, double?overridingMinValue)
 {
     return(RandomValueGen.GetMinValue(propRule, overridingMinValue));
 }
Esempio n. 8
0
        public override object GenerateValidValue()
        {
            PropRuleDouble propRule = base.GetPropRule <PropRuleDouble>();

            return((propRule == null) ? RandomValueGen.GetRandomDouble() : RandomValueGen.GetRandomDouble(propRule.MinValue, propRule.MaxValue));
        }
 private static long GetMinValue(IPropRuleComparable <long> propRule, long?overridingMinValue)
 {
     return(RandomValueGen.GetMinValue(propRule, overridingMinValue));
 }
Esempio n. 10
0
 private static DateTime GetMinValue(IPropRuleComparable <DateTime> propRule, DateTime?overridingMinValue)
 {
     return(RandomValueGen.GetMinValue(propRule, overridingMinValue));
 }
Esempio n. 11
0
 private static decimal GetMinValue(IPropRuleComparable <decimal> propRule, decimal?overridingMinValue)
 {
     return(RandomValueGen.GetMinValue(propRule, overridingMinValue));
 }
 private static object GetLookupListValue(ILookupList lookupList)
 {
     return(((lookupList == null) || (lookupList is NullLookupList)) ? null : RandomValueGen.GetRandomLookupListValue(lookupList.GetLookupList()));
 }