/// <summary> /// Generates the users. /// </summary> /// <param name="count">The count.</param> /// <returns> /// The users /// </returns> public static IEnumerable <UserDocument> GenerateUsers(int count) { var users = new List <UserDocument>(); for (var i = 0; i < count; i++) { var id = NewIdentifier(); var user = new UserDocument() { FirstName = GenerateRandomString(), LastName = GenerateRandomString(), UserEmail = $"{id}@test.com", UserId = id }; user.UserPartition = GetUserPartition(user); users.Add(user); } return(users); }
/// <summary> /// Gets the user partition. /// </summary> /// <param name="document">The document.</param> /// <returns> /// A string representing the user partition. /// </returns> public static string GetUserPartition(UserDocument document) { const string DefaultPartition = "0"; return(!string.IsNullOrEmpty(document.LastName) ? document.LastName[0].ToString() : DefaultPartition); }