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 FakeOrder Fake() { return(new FakeOrder() { Id = Guid.NewGuid(), UserId = Guid.NewGuid(), ProductId = Guid.NewGuid(), Recipient = FakeUtility.CreatePersonName(GenderType.None), Amount = FakeUtility.RandomDouble(10, 1000), Address = "测试地址", Number = FakeUtility.RandomInt(1, 10), CreateTime = DateTime.Now }); }
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 static FakeProduct Fake() { return(new FakeProduct() { Id = Guid.NewGuid(), Title = "商品" + Guid.NewGuid().GetHashCode(), Description = string.Empty, Price = FakeUtility.RandomDouble(1, 1000), Picture = string.Empty, SourceUri = string.Empty, Follows = FakeUtility.RandomInt(1, 100), SourceSite = string.Empty, Status = (ProductStatusType)FakeUtility.RandomInt(0, 3), VisitTotal = FakeUtility.RandomInt(1, 10), CreateTime = DateTime.Now }); }
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 }); }
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); }