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);
        }
Beispiel #2
0
 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 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);
        }
Beispiel #4
0
 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 CreatePersonNameTest()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            var names = new List <string>();

            for (int i = 0; i < 100; i++)
            {
                var name = FakeUtility.CreatePersonName(GenderType.Female);
                names.Add(name);
            }
            sw.Stop();
            Trace.WriteLine("耗时:" + sw.Elapsed);
            foreach (var name in names)
            {
                Trace.WriteLine(name);
            }
        }
        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);
        }