forked from ALCOpenSource/Mentor-Management-System-Team-5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ALCOpenSource#201 from Honeyloveet/backend/add-dum…
…my-data added dummy user data generator
- Loading branch information
Showing
3 changed files
with
71 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Bogus; | ||
using mms.Domain.Entities; | ||
|
||
namespace mms.Infrastructure.Seeder | ||
{ | ||
public static class DataGenerator | ||
{ | ||
public static readonly List<AppUser> MentorsAndManagers = new(); | ||
|
||
public const int NumberOfMentorsAndManagers = 60; | ||
|
||
public static void InitMentorsAndManagersData() | ||
{ | ||
var mentorsAndManagersGenerator = GetMentorsAndManagersGenerator(); | ||
var generatedMentorsAndManagers = mentorsAndManagersGenerator.Generate(NumberOfMentorsAndManagers); | ||
MentorsAndManagers.AddRange(generatedMentorsAndManagers); | ||
} | ||
|
||
private static Faker<AppUser> GetMentorsAndManagersGenerator() | ||
{ | ||
return new Faker<AppUser>() | ||
.RuleFor(e => e.Id, _ => Guid.NewGuid().ToString()) | ||
.RuleFor(e => e.About, f => f.Lorem.Paragraph(1)) | ||
.RuleFor(e => e.FirstName, f => f.Name.FirstName()) | ||
.RuleFor(e => e.LastName, f => f.Name.LastName()) | ||
.RuleFor(e => e.IsActive, f => true) | ||
.RuleFor(e => e.DateCreated, f => DateTime.Now) | ||
.RuleFor(e => e.Email, (f, e) => f.Internet.Email(e.FirstName, e.LastName)) | ||
.RuleFor(e => e.EmailConfirmed, f => true) | ||
.RuleFor(e => e.UserName, (f, e) => e.FirstName) | ||
.RuleFor(e => e.Country, f => f.Address.Country()) | ||
.RuleFor(e => e.City, f => f.Address.City()) | ||
.RuleFor(e => e.State, (f, e) => e.City); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters