private List <FakeUser> CreateOneUser(int total) { var list = new List <FakeUser>(); if (total < 1) { return(list); } for (int i = 0; i < total; i++) { var gender = FakeUtility.CreateGender(); var fakeUser = new FakeUser() { Id = FakeUtility.CreateGuid(), RealName = FakeUtility.CreatePersonName(gender), Username = FakeUtility.CreateUsername(), Password = FakeUtility.CreatePassword(), Address = "XXXX路yy号", Mobile = FakeUtility.CreateMobile(), Email = FakeUtility.CreateEmail(), Points = FakeUtility.RandomInt(0, 100), Birthday = FakeUtility.CreateBirthday(), PersonHeight = FakeUtility.CreatePersonHeight(), CreateTime = DateTime.Now }; list.Add(fakeUser); } return(list); }
public static FakeUser Fake() { return(new FakeUser() { Id = Guid.NewGuid(), Username = FakeUtility.CreateUsername(6, 12), Password = FakeUtility.CreatePassword(6), RealName = FakeUtility.CreatePersonName(GenderType.None), Gender = (GenderType)FakeUtility.RandomInt(0, 2), Mobile = FakeUtility.CreateMobile(), Email = FakeUtility.CreateEmail(), Address = "测试地址", Points = FakeUtility.RandomInt(1, 200), PersonHeight = FakeUtility.CreatePersonHeight(), Birthday = FakeUtility.CreateBirthday(1980), CreateTime = DateTime.Now }); }
public void CreateBirthdayTest() { Stopwatch sw = new Stopwatch(); sw.Start(); var result = new List <DateTime>(); for (int i = 0; i < 100; i++) { var date = FakeUtility.CreateBirthday(1970); result.Add(date); } sw.Stop(); Trace.WriteLine("耗时:" + sw.Elapsed); foreach (var item in result) { Trace.WriteLine(item.ToString("yyyy-MM-dd")); } }
private FakeUser CreateOneUser() { var gender = FakeUtility.CreateGender(); var fakeUser = new FakeUser() { Id = FakeUtility.CreateGuid(), RealName = FakeUtility.CreatePersonName(gender), Username = FakeUtility.CreateUsername(), Password = FakeUtility.CreatePassword(), Address = "XXXX路yy号", Mobile = FakeUtility.CreateMobile(), Email = FakeUtility.CreateEmail(), Points = FakeUtility.RandomInt(0, 100), Birthday = FakeUtility.CreateBirthday(), PersonHeight = FakeUtility.CreatePersonHeight(), CreateTime = DateTime.Now }; return(fakeUser); }