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 void UpdateOneEntityTest() { var fakeUser = FakeItem(); fakeUser.Gender = FakeUtility.CreateGender(); fakeUser.Password = FakeUtility.CreatePassword(); fakeUser.Email = FakeUtility.CreateEmail(); fakeUser.Age = FakeUtility.RandomInt(18, 50); fakeUser.UpdateTime = DateTime.Now; var updated = _userRepository.UpdateAsync(fakeUser).GetAwaiter().GetResult(); Assert.IsTrue(updated); }
public void AddOneTest() { var gender = FakeUtility.CreateGender(); var item = new User() { Username = FakeUtility.CreateUsername(5, 10), Password = FakeUtility.CreatePassword(), Email = FakeUtility.CreateEmail(), Name = FakeUtility.CreatePersonName(gender), Gender = gender, Age = FakeUtility.RandomInt(18, 50), CreateTime = DateTime.Now }; _userRepository.AddAsync(item).GetAwaiter().GetResult(); Assert.IsTrue(true); }
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 CreateEmailTest() { Stopwatch sw = new Stopwatch(); sw.Start(); var emails = new List <string>(); for (int i = 0; i < 100; i++) { var email = FakeUtility.CreateEmail(); emails.Add(email); } sw.Stop(); Trace.WriteLine("耗时:" + sw.Elapsed); foreach (var item in emails) { Trace.WriteLine(item); } }
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); }
public void AddBatchTest() { var list = new List <User>(); for (int i = 0; i < 10; i++) { var gender = FakeUtility.CreateGender(); var item = new User() { Username = FakeUtility.CreateUsername(5, 10), Password = FakeUtility.CreatePassword(), Email = FakeUtility.CreateEmail(), Name = FakeUtility.CreatePersonName(gender), Gender = gender, Age = FakeUtility.RandomInt(18, 50), CreateTime = DateTime.Now }; list.Add(item); } _userRepository.AddBatchAsync(list).GetAwaiter().GetResult(); Assert.IsTrue(true); }