예제 #1
0
 /// <summary>
 /// Gets a p element containing lorem ipsum
 /// </summary>
 /// <example>To create 3 paragraphs each 6 sentences nested in HTML 'p' tags.
 /// <code>@Html.p(3, 6)</code>
 /// </example>
 /// <param name="paragraphCount"></param>
 /// <param name="sentenceCount"></param>
 /// <param name="htmlAttributes"></param>
 /// <returns></returns>
 public WireframeGenerator P(int paragraphCount = 1, int sentenceCount = 5, object htmlAttributes = null)
 {
     for (int i = 0; i < paragraphCount; i++)
     {
         contentBuffer.Add(GenerateHtmlIpsum("p", () => Lorem.GenerateSentences(sentenceCount), htmlAttributes));
     }
     return(this);
 }
예제 #2
0
        public static async Task Initialize(
            ApplicationDbContext dbContext,
            UserManager <ApplicationUser> userManager)
        {
            dbContext.Database.EnsureCreated();

            // Look for any students.
            if (dbContext.KnoledgeEntries.Any())
            {
                return;   // DB has been seeded
            }

            await CreateUserAsync(dbContext, userManager);

            GenFu.GenFu.Configure <Document>()
            .Fill(x => x.Id, 0)
            .Fill(x => x.Type).WithRandom(new[]
            {
                DocumentType.Audio,
                DocumentType.Video,
                DocumentType.Image,
                DocumentType.Document
            });

            GenFu.GenFu.Configure <Link>()
            .Fill(x => x.Id, 0);

            GenFu.GenFu.Configure <KnowledgeEntry>()
            .Fill(x => x.Id, 0)
            .Fill(x => x.Content, () => Lorem.GenerateSentences(GenFu.GenFu.Random.Next(1, 6)))
            .Fill(x => x.Link, () => null)
            .Fill(x => x.Documents, () => null)
            .Fill(x => x.Date, () => new DateTime(
                      GenFu.GenFu.Random.Next(2010, 2016),
                      GenFu.GenFu.Random.Next(1, 12),
                      GenFu.GenFu.Random.Next(1, 29),
                      GenFu.GenFu.Random.Next(0, 23),
                      GenFu.GenFu.Random.Next(0, 59),
                      GenFu.GenFu.Random.Next(0, 59)));


            var entries = A.ListOf <KnowledgeEntry>(300);

            foreach (var entry in entries)
            {
                dbContext.KnoledgeEntries.Add(entry);
                dbContext.SaveChanges();

                var link = A.New <Link>();
                link.KnoledgeEntryId = entry.Id;
                dbContext.Links.Add(link);
                dbContext.SaveChanges();

                var documents = A.ListOf <Document>(GenFu.GenFu.Random.Next(0, 10));
                dbContext.Documents.AddRange(documents.Select(x =>
                {
                    x.KnoledgeEntryId = entry.Id;
                    return(x);
                }));
                dbContext.SaveChanges();
            }
        }
예제 #3
0
        public IHtmlContent Paragraphs(int count)
        {
            var paragraphs = Lorem.GenerateSentences(count);

            return(new HtmlString(paragraphs));
        }