Exemplo n.º 1
0
        public static IDictionary <Type, object> CreateDefaultPropertyValues()
        {
            IDictionary <Type, object> result = new Dictionary <Type, object>();

            //CRITICAL: Don't remove any types from this list. These types
            //are required in order to reliably test object CRUD functionality.

            result.Add(typeof(Boolean), true);
            result.Add(typeof(Byte), DataGenenerator.CreateRandomByte());
            result.Add(typeof(Char), Char.MaxValue);
            result.Add(typeof(DateTime), new DateTime(2000, 01, 07));
            result.Add(typeof(Date), new Date(DateTime.MaxValue));
            result.Add(typeof(DateRange), new DateRange(new Date("2000-01-07"), new Date("2009-01-07")));
            result.Add(typeof(Decimal), 100000m);
            result.Add(typeof(Double), 10000d);
            result.Add(typeof(Enum), DataGenenerator.CreateConstantGenerator(1));
            result.Add(typeof(Guid), DataGenenerator.CreateGuidGenerator());
            result.Add(typeof(Int16), 1000);
            result.Add(typeof(Int32), 10000);
            result.Add(typeof(Int64), 10000);
            result.Add(typeof(SByte), SByte.MaxValue);
            result.Add(typeof(Single), 10000f);
            result.Add(typeof(String), DataGenenerator.CreatePropertyNameGenerator());
            result.Add(typeof(UInt16), 1000);
            result.Add(typeof(UInt32), 10000);
            result.Add(typeof(UInt64), 1000);
            return(result);
        }
Exemplo n.º 2
0
        private static IDictionary <Type, IDataGenerator> CreateDataGenerators(IDictionary <Type, object> propertyValues)
        {
            var result = new Dictionary <Type, IDataGenerator>(propertyValues.Count);

            foreach (KeyValuePair <Type, object> entry in propertyValues)
            {
                if (entry.Value is IDataGenerator)
                {
                    result.Add(entry.Key, (IDataGenerator)entry.Value);
                }
                else
                {
                    result.Add(entry.Key, DataGenenerator.CreateConstantGenerator(entry.Value));
                }
            }
            return(result);
        }