#region ========================================================================= USING ===================================================================================== using Bogus; using Lumina.Application.Common.DataAccess.Entities.Authorization; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; #endregion namespace Lumina.Application.Fixtures.Common.DataAccess.Entities.Authorization; /// /// Fixture class for the class. /// [ExcludeFromCodeCoverage] public class UserRoleEntityFixture { /// /// Creates a random valid . /// /// The created . public UserRoleEntity Create() { return new Faker() .CustomInstantiator(f => new UserRoleEntity { Id = f.Random.Guid(), UserId = f.Random.Guid(), User = new() { Id = f.Random.Guid(), Username = f.Internet.UserName(), Password = f.Internet.Password(), Libraries = [], UserRole = null, UserPermissions = [], CreatedOnUtc = f.Date.Past(), CreatedBy = f.Random.Guid() }, RoleId = f.Random.Guid(), Role = new() { Id = f.Random.Guid(), RoleName = f.Random.String2(f.Random.Number(1, 50)), CreatedOnUtc = f.Date.Past(), CreatedBy = f.Random.Guid() }, CreatedOnUtc = f.Date.Past(), CreatedBy = f.Random.Guid() }) .Generate(); } /// /// Creates a list of instances with randomized test data. /// /// Number of instances to create. /// List of configured instances. public List CreateMany(int count = 3) { return [.. Enumerable.Range(0, count).Select(_ => Create())]; } }