public UserManualsControllerTest(ApplicationDbContextFixture contextFixture) { Context = contextFixture.DbContext; RoleManager = contextFixture.RoleManager; UserManager = contextFixture.UserManager; Moderador = UserManager.FindByNameAsync("ModeradorTeste").Result; Cliente = UserManager.FindByNameAsync("InêsBotelho").Result; Prestador = UserManager.FindByNameAsync("PrestadorTeste").Result; Administrador = UserManager.FindByNameAsync("AdministradorTeste").Result; ClienteRole = RoleManager.FindByNameAsync("Cliente").Result; ModeradoresRole = RoleManager.FindByNameAsync("Moderador").Result; PrestadorRole = RoleManager.FindByNameAsync("Prestador").Result; AdministradorRole = RoleManager.FindByNameAsync("Administrador").Result; Controller = new UserManualsController(Context, UserManager); ModeradorLog = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim>() { new Claim(ClaimTypes.Name, Moderador.UserName), new Claim(ClaimTypes.Email, Moderador.Email), new Claim(ClaimTypes.NameIdentifier, Moderador.Id), new Claim(ClaimTypes.Role, ModeradoresRole.Name), }, "Test")); ClientLog = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim>() { new Claim(ClaimTypes.Name, Cliente.UserName), new Claim(ClaimTypes.Email, Cliente.Email), new Claim(ClaimTypes.NameIdentifier, Cliente.Id), new Claim(ClaimTypes.Role, ClienteRole.Name), }, "Test")); AdministradorLog = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim>() { new Claim(ClaimTypes.Name, Administrador.UserName), new Claim(ClaimTypes.Email, Administrador.Email), new Claim(ClaimTypes.NameIdentifier, Administrador.Id), new Claim(ClaimTypes.Role, AdministradorRole.Name), }, "Test")); PrestadorLog = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim>() { new Claim(ClaimTypes.Name, Prestador.UserName), new Claim(ClaimTypes.Email, Prestador.Email), new Claim(ClaimTypes.NameIdentifier, Prestador.Id), new Claim(ClaimTypes.Role, PrestadorRole.Name), }, "Test")); }
public SectionsControllerTest(ApplicationDbContextFixture contextFixture) { Context = contextFixture.DbContext; RoleManager = contextFixture.RoleManager; UserManager = contextFixture.UserManager; Moderador = contextFixture.Moderador; Cliente = contextFixture.Cliente; Prestador = contextFixture.Prestador; Administrador = contextFixture.Administrador; ModeradorLog = contextFixture.ModeradorLog; ClientLog = contextFixture.ClientLog; PrestadorLog = contextFixture.PrestadorLog; AdministradorLog = contextFixture.AdministradorLog; ClienteRole = contextFixture.ClienteRole; ModeradoresRole = contextFixture.ModeradoresRole; PrestadorRole = contextFixture.PrestadorRole; AdministradorRole = contextFixture.AdministradorRole; Controller = new SectionsController(Context, UserManager); UserManualController = new UserManualsController(Context, UserManager); }