Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("App is running!");

            TestClass1 test1 = FakerSingleton.getInstance().Create <TestClass1>();
            TestClass3 test2 = FakerSingleton.getInstance().Create <TestClass3>();

            foreach (byte elem in test1.val10)
            {
                Console.WriteLine(elem);
            }

            Console.ReadKey();
        }
Пример #2
0
        public object GenerateValue(Type type)
        {
            object result = null;
            Func <Random, object> genDelegate = null;

            if (type.IsGenericType && (type.GetInterface(nameof(IList)) != null))
            {
                result = new ListGenerator(type.GenericTypeArguments[0]).GenerateValue(FakerSingleton.random);
            }
            else if (generatorsDict.TryGetValue(type, out genDelegate))
            {
                result = genDelegate(FakerSingleton.random);
            }
            else
            {
                if (!FakerSingleton.getInstance().antiCycleList.Contains(type))
                {
                    result = FakerSingleton.getInstance().Create(type);
                }
            }

            return(result);
        }