Exemplo n.º 1
0
        public bool TryParse(ValueParser valueParser, out string value)
        {
            if (valueParser.Id == ID)
            {
                var min = Convert.ToDouble(valueParser.Min);
                var max = Convert.ToDouble(valueParser.Max);

                var money = _rand.NextDouble() * (max - min) + min;
                value = Math.Round(money, 2).ToString();
                return(true);
            }
            value = "";
            return(false);
        }
        public string Generate(string expression)
        {
            var valueParser = new ValueParser(expression);

            for (var i = 0; i < _valueGenerators.Count; i++)
            {
                string line;
                if (_valueGenerators[i].TryParse(valueParser, out line))
                {
                    return(line);
                }
            }

            return(NOT_IMPLEMENTED);
        }