ModelBuilder.AddressValueGenerator.GenerateValue C# (CSharp) Method

GenerateValue() protected method

protected GenerateValue ( Type type, string referenceName, LinkedList buildChain ) : object
type System.Type
referenceName string
buildChain LinkedList
return object
        protected override object GenerateValue(Type type, string referenceName, LinkedList<object> buildChain)
        {
            var multipleMatch = _multipleAddressExpression.Match(referenceName);

            if (multipleMatch.Success)
            {
                // Get the number from the match
                var number = int.Parse(multipleMatch.Groups["Number"].Value, CultureInfo.InvariantCulture);

                if (number == 1)
                {
                    var floor = Generator.NextValue(1, 15);
                    var unitIndex = Generator.NextValue(0, 15);
                    var unit = (char) (65 + unitIndex);

                    // Return a Unit Xy, Floor X style value
                    return "Unit " + floor + unit + ", Floor " + floor;
                }

                if (number > 2)
                {
                    return null;
                }
            }

            var person = TestData.NextPerson();

            return person.Address;
        }