public void InitializerTests() { var initializer = new IdentityInitializer(_validateDatabase, _userManager, _droneRoleValidator); _droneRoleValidator.CreateRoleAsync(Arg.Any <string>()).Returns(true); _droneRoleValidator.ExistRoleAsync(Arg.Any <string>()).Returns(true); _validateDatabase.EnsureCreated().Returns(true); initializer.Initialize(); _userManager.Received().FindByNameAsync(Arg.Any <string>()); }
public void Initialize() { if (_validateDatabase.EnsureCreated()) { if (!_droneRoleValidator.ExistRoleAsync(Roles.ROLE_API_DRONE).Result) { var resultado = _droneRoleValidator.CreateRoleAsync(Roles.ROLE_API_DRONE).Result; if (!resultado) { throw new Exception( $"Erro durante a criação da role {Roles.ROLE_API_DRONE}."); } } CreateUser( new ApplicationUser() { UserName = "******", Email = "*****@*****.**", EmailConfirmed = true }, "AdminAPIDrone01!", Roles.ROLE_API_DRONE); CreateUser( new ApplicationUser() { UserName = "******", Email = "*****@*****.**", EmailConfirmed = true }, "UsrInvAPIDrone01!"); } }