Exemplo n.º 1
0
        public async Task ConsultarOficinas_Oficina_Success()
        {
            //Arrange
            Oficina oficina = new Oficina()
            {
                Id               = 1,
                Nome             = "Oficina Gecar",
                Descricao        = "A oficina Gecar presta serviços em Betim a mais de 30 anos",
                DescricaoCurta   = "Lanternagem e pintura",
                Endereco         = "Rua Ignês Maria",
                Latitude         = "-19.9622435",
                Longitude        = "-44.175102",
                Foto             = "iVBORw0KGgoAAAANSUhEUgAAAQAAAABfCAYAAAAH3RnwAAAABmJLR0QA/wD/AP+/n57X3Oufe+++9O5yz9/",
                AvaliacaoUsuario = 0,
                CodigoAssociacao = 601,
                Email            = "*****@*****.**",
                Telefone1        = "31 35353535",
                Telefone2        = "",
                Ativo            = true,
            };

            List <Oficina> oficinasExpected = new List <Oficina>();

            oficinasExpected.Add(oficina);

            Moq.Mock <IHinovaAdapter> hinovaAdapterMoq = new Moq.Mock <IHinovaAdapter>();
            hinovaAdapterMoq.Setup(x => x.ConsultarOficinas(It.IsAny <int>(), It.IsAny <string>())).ReturnsAsync(oficinasExpected);
            IOficinaService saleService = new OficinaService(hinovaAdapterMoq.Object);

            //Act
            var result = await saleService.ConsultarOficinas(601, "");

            //Assert
            Assert.True(result.Equals(oficinasExpected));
        }
Exemplo n.º 2
0
        protected void Application_AcquireRequestState(object sender, EventArgs e)
        {
            var authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

            if (authCookie != null)
            {
                string enc = authCookie.Value;
                if (!String.IsNullOrEmpty(enc) && HttpContext.Current.Session != null && HttpContext.Current.Session["Usuario"] == null)
                {
                    int nMaximoSubEntrevistas = Convert.ToInt16(ConfigurationManager.AppSettings["numeroMaximoSubEntrevistas"].ToString());
                    HttpContext.Current.Session.Add("NumeroSubEntrevistas", nMaximoSubEntrevistas);

                    var user = FormsAuthentication.Decrypt(enc);
                    var id   = new UserIdentity(user);

                    IUsuarioRepository _usuarioRepository = new UsuarioRepository();
                    IUsuarioService    _usuarioService    = new UsuarioService(_usuarioRepository);

                    var responseUsuario = _usuarioService.GetUsuarioRolPermisoByUserName(id.Name);

                    if (responseUsuario.IsValid)
                    {
                        HttpContext.Current.Session.Add("Usuario", responseUsuario.UsuarioRolPermisoViewModel);
                        HttpContext.Current.Session.Add("UsuarioId", responseUsuario.UsuarioRolPermisoViewModel.UsuarioId);
                        if (responseUsuario.UsuarioRolPermisoViewModel.CentroIdUsuario != null)
                        {
                            HttpContext.Current.Session.Add("CentroIdUsuario", responseUsuario.UsuarioRolPermisoViewModel.CentroIdUsuario);
                        }
                        IOficinaRepository _oficinaRepository = new OficinaRepository();
                        IOficinaService    _oficinaService    = new OficinaService(_oficinaRepository);
                        var centroId        = responseUsuario.UsuarioRolPermisoViewModel.CentroIdUsuario != null ? (int)responseUsuario.UsuarioRolPermisoViewModel.CentroIdUsuario : 0;
                        var responseOficina = _oficinaService.GetOficinasByCentro(centroId);
                        HttpContext.Current.Session.Add("OficinaIdCentroUsuario", responseOficina.ListaOficinasIdNombre);
                    }

                    ICentroRepository _centroRepository = new CentroRepository();
                    ICentroService    _centroService    = new CentroService(_centroRepository);

                    var centrosResponse = _centroService.GetCentros();

                    if (centrosResponse.IsValid)
                    {
                        HttpContext.Current.Session.Add("ListaCentros", centrosResponse.ListaCentrosIdNombre);
                    }

                    IPersonaLibreRepository _personaLibreRepository = new PersonaLibreRepository();
                    IPersonasLibresService  _personaLibreService    = new PersonaLibreService(_personaLibreRepository);

                    var categoriaLineaCeldaResponse = _personaLibreService.GetListCategoriaLineaCelda();

                    if (categoriaLineaCeldaResponse.IsValid)
                    {
                        HttpContext.Current.Session.Add("CategoriaLineaCelda", categoriaLineaCeldaResponse.PersonasLibresListCategoriaLineaCeldaviewModel);
                    }
                }
            }
        }
Exemplo n.º 3
0
 public ConsultasController(SeguroService seguroService, ApoliceService apoliceService, AutomovelService automovelService, AbastecimentoService abastecimentoService, ManutencaoService manutencaoService, MotoristaService motoristaService, MultaService multaService, OficinaService oficinaService, PostoService postoService, ViagemService viagemService, TodosMotoristaService todosMotoristaService, TodosAutomovelService todosAutomovelService)
 {
     _seguroService         = seguroService;
     _apoliceService        = apoliceService;
     _automovelService      = automovelService;
     _abastecimentoService  = abastecimentoService;
     _manutencaoService     = manutencaoService;
     _motoristaService      = motoristaService;
     _multaService          = multaService;
     _oficinaService        = oficinaService;
     _postoService          = postoService;
     _viagemService         = viagemService;
     _todosMotorstaService  = todosMotoristaService;
     _todosAutomovelService = todosAutomovelService;
 }
Exemplo n.º 4
0
 public OficinaAppService(OficinaService oficinaService)
     : base(oficinaService)
 {
     _oficinaService = oficinaService;
 }