GenFu.Web.Models.SourceCode.GenerateData C# (CSharp) Method

GenerateData() public method

public GenerateData ( int count ) : IEnumerable
count int
return IEnumerable
        public IEnumerable<RandomValues> GenerateData(int count)
        {
            if (IsLegit())
            {
                // this path isn't doing anything yet...
                var randomObjects = A.ListOf(_compiledType, count);

                // make sure there's nothing fishy about the generated type
                if (randomObjects.All(o => ValidateResult(o)))
                {
                    return randomObjects.Select(r => GetPropertyValues(r));
                }
            }

            return null;
        }

Usage Example

Ejemplo n.º 1
0
        public IActionResult Index(SourceCode sourceCode)
        {
            GenerateDataModel model = new GenerateDataModel();
            model.Source = sourceCode.Source;

            // todo: make not hacky
            sourceCode.Accessor = _accessor;
            sourceCode.LibraryExporter = _exporter;

            var compileResult = sourceCode.Compile();

            if (!compileResult.IsValid)
            {
                model.HasCompileErrors = true;
                model.CompileErrors = compileResult.Errors;
            }
            else
            {
                model.RandomObjects = sourceCode.GenerateData(10);
                model.PropertyNames = model.RandomObjects.First().Keys;
            }

            return View(model);
        }
All Usage Examples Of GenFu.Web.Models.SourceCode::GenerateData