Пример #1
0
        public static CremaDataSet CreateRandomSet()
        {
            var dataSet = new CremaDataSet();

            dataSet.AddRandomTypes(RandomUtility.Next(MinTypeCount, MaxTypeCount));
            dataSet.AddRandomTables(RandomUtility.Next(MinTableCount, MaxTableCount));
            dataSet.AddRandomChildTables(RandomUtility.Next(MinTableCount, MaxTableCount));
            dataSet.AddDerivedTables(RandomUtility.Next(MinTableCount, MaxTableCount));

            return(dataSet);
        }
Пример #2
0
        public static void AddRandoms(this CremaDataSet dataSet, int tryCount)
        {
            var t1 = Math.Max(1, (int)(tryCount * 0.25));
            var t2 = Math.Max(1, (int)(tryCount * 0.50));
            var t3 = Math.Max(1, (int)(tryCount * 0.25));

            dataSet.AddRandomTypes(t1);
            dataSet.AddRandomTables(t2);
            for (var i = 0; i < t3; i++)
            {
                dataSet.Tables.Random(item => item.Parent == null).AddRandomChild();
            }
        }