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 void CreateGenderTest() { Stopwatch sw = new Stopwatch(); sw.Start(); var result = new List <GenderType>(); for (int i = 0; i < 100; i++) { var value = FakeUtility.CreateGender(); result.Add(value); } sw.Stop(); Trace.WriteLine("耗时:" + sw.Elapsed); foreach (var item in result) { 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); }