private UserEntity CreateUser(
string name = null,
string email = null,
RoleEntity role = null,
string login = null,
string password = null,
bool noDefaultRole = false)
{
if (!noDefaultRole)
{
role = role ??
new PersistenceSpecification<RoleEntity>(this.Session).CheckProperty(
c => c.Name, this.ShortStringGenerator.GetRandomValue()).VerifyTheMappings();
}
var user = new UserEntity
{
Name = name ?? this.NormalStringGenerator.GetRandomValue(),
Email = email ?? this.NormalStringGenerator.GetRandomValue(),
Role = role
};
login = login ?? this.NormalStringGenerator.GetRandomValue();
password = password ?? this.NormalStringGenerator.GetRandomValue();
var manager = this.Locator.GetInstance<IUserManager>();
manager.Create(user, login, password);
return user;
}