protected internal override string GenerateValue() { if (_allowedValues != null && _allowedValues.Count > 0) { return((string)this.Datatype.ChangeType(RandomGenerator.Categorical.GetCategorical(_allowedValues), TypeUtil.TypeString)); } else { this.ResultBuilder.Clear(); _genr.Prefix = this.Prefix; int numOfItems = this.ListLength; if (_length != -1) { numOfItems = _length; } else if (_minLength != -1) { numOfItems = _minLength; } else if (_maxLength != -1) { numOfItems = _maxLength; } for (int i = 0; i < numOfItems; i++) { _resultBuilder.Append(_genr.GenerateValue()); _resultBuilder.Append(" "); } } return(_resultBuilder.ToString()); }
protected internal override string GenerateValue() { if (_allowedValues != null && _allowedValues.Count > 0) { object result = RandomGenerator.Categorical.GetCategorical(_allowedValues); //Unpack the union enumeration value into memberType and typedValue object typedValue = CompiledFacets.XsdSimpleValueType.InvokeMember("typedValue", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance, null, result, null); return((string)this.Datatype.ChangeType(typedValue, TypeUtil.TypeString)); } else if (unionGens.Count > 0) { int rnd = Convert.ToInt32(RandomGenerator.Numeric.GetUniform(0, unionGens.Count)); XmlValueGenerator genr = (XmlValueGenerator)(unionGens[rnd]); genr.Prefix = this.Prefix; return(genr.GenerateValue()); } return(string.Empty); }