Ejemplo n.º 1
0
        private IDictionary <Type, Func <object> > InitializeMappings()
        {
            var mappings = new Dictionary <Type, Func <object> >
            {
                { typeof(string), () => DataGenerator.GenerateString() },
                { typeof(Uri), () => DataGenerator.GenerateUri() },
                { typeof(Int32), () => DataGenerator.GenerateInteger() },
                { typeof(int?), () => DataGenerator.GenerateBoolean()
                                             ? DataGenerator.GenerateInteger()
                                             : (object)null },
                { typeof(long), () => DataGenerator.GenerateLong() },
                { typeof(long?), () => DataGenerator.GenerateBoolean()
                        ? DataGenerator.GenerateLong()
                        : (object)null },
                { typeof(double), () => DataGenerator.GenerateDouble() },
                { typeof(double?), () => DataGenerator.GenerateBoolean()
                        ? DataGenerator.GenerateDouble()
                        : (object)null },
                { typeof(float), () => DataGenerator.GenerateFloat() },
                { typeof(float?), () => DataGenerator.GenerateBoolean()
                        ? DataGenerator.GenerateFloat()
                        : (object)null },
                { typeof(DateTime), () => DataGenerator.GenerateDateTime() },
                { typeof(DateTime?), () => DataGenerator.GenerateBoolean()
                        ? DataGenerator.GenerateDateTime()
                        : (object)null },
                { typeof(Guid), () => Guid.NewGuid() }
            };

            return(mappings);
        }