コード例 #1
0
        public static void Cleanup()
        {
            var randomizersList = new Dictionary <Type, IRandomizeble>();

            randomizersList[typeof(decimal)]  = new DecimalRandom();
            randomizersList[typeof(string)]   = new StringRandom();
            randomizersList[typeof(char)]     = new CharRandom();
            randomizersList[typeof(int)]      = new Int32Random();
            randomizersList[typeof(long)]     = new Int64Random();
            randomizersList[typeof(bool)]     = new BoolRandom();
            randomizersList[typeof(byte)]     = new ByteRandom();
            randomizersList[typeof(sbyte)]    = new SByteRandom();
            randomizersList[typeof(float)]    = new FloatRandom();
            randomizersList[typeof(double)]   = new DoubleRandom();
            randomizersList[typeof(short)]    = new Int16Random();
            randomizersList[typeof(uint)]     = new UInt32Random();
            randomizersList[typeof(ushort)]   = new UInt16Random();
            randomizersList[typeof(ulong)]    = new UInt64Random();
            randomizersList[typeof(DateTime)] = new DateTimeRandom();
            UniversalRandom.AddRandomizers(randomizersList);

            UniversalRandom.AddInterceptors(new List <IInterceptor>
            {
                new ListInterceptor(),
                new EnumInterceptor(),
                new ArrayInterceptor()
            });
        }
コード例 #2
0
        static UniversalRandom()
        {
            _randomizers[typeof(decimal)]  = new DecimalRandom();
            _randomizers[typeof(string)]   = new StringRandom();
            _randomizers[typeof(char)]     = new CharRandom();
            _randomizers[typeof(int)]      = new Int32Random();
            _randomizers[typeof(long)]     = new Int64Random();
            _randomizers[typeof(bool)]     = new BoolRandom();
            _randomizers[typeof(byte)]     = new ByteRandom();
            _randomizers[typeof(sbyte)]    = new SByteRandom();
            _randomizers[typeof(float)]    = new FloatRandom();
            _randomizers[typeof(double)]   = new DoubleRandom();
            _randomizers[typeof(short)]    = new Int16Random();
            _randomizers[typeof(uint)]     = new UInt32Random();
            _randomizers[typeof(ushort)]   = new UInt16Random();
            _randomizers[typeof(ulong)]    = new UInt64Random();
            _randomizers[typeof(DateTime)] = new DateTimeRandom();

            _interceptors.Add(new ArrayInterceptor());
            _interceptors.Add(new EnumInterceptor());
            _interceptors.Add(new ListInterceptor());
        }