Ejemplo n.º 1
0
 public void DateTimeFakerTest()
 {
     DisplayAndExecute(new Expression <Func <DateTime> >[] {
         () => DateTimeFaker.DateTime(),
         () => DateTimeFaker.DateTime(DateTime.Parse("1980-5-13"), DateTime.Parse("2060-7-13")),
         () => DateTimeFaker.DateTimeBetweenDays(0, 30),
         () => DateTimeFaker.DateTimeBetweenDays(20),
         () => DateTimeFaker.DateTimeBetweenMonths(6, 0),
         () => DateTimeFaker.DateTimeBetweenMonths(9),
         () => DateTimeFaker.DateTimeBetweenYears(0, 1),
         () => DateTimeFaker.DateTimeBetweenYears(5),
         () => DateTimeFaker.BirthDay(33),
         () => DateTimeFaker.BirthDay()
     });
 }
Ejemplo n.º 2
0
Archivo: Book.cs Proyecto: snluu/nkv
        public static Book Generate()
        {
            var lipsumGenerator = new LipsumGenerator();

            return(new Book
            {
                Key = Guid.NewGuid().ToString(),
                Title = lipsumGenerator.GenerateSentences(1, Sentence.Short)[0],
                Abstract = lipsumGenerator.GenerateParagraphs(1, Paragraph.Medium)[0],
                Authors = new string[] { NameFaker.Name(), NameFaker.Name() },
                Price = 9999m * (decimal)_rand.NextDouble() + 0.99m,
                ReleaseDate = DateTimeFaker.BirthDay(),
                Pages = _rand.Next(5, 3000),
                Category = EnumFaker.SelectFrom <BookCategory>()
            });
        }