Exemple #1
0
        public AnuncioServiceIntegrationTest()
        {
            //Arrange
            string                    connectionString         = "Server=HIDEAKIUCHIDA;Database=EVERESTDB;Integrated Security=True;";
            string                    avanticaConnectionString = "Server=LIM-WS00279\\SQLEXPRESS;Database=EVERESTDB;Integrated Security=True;";
            IDbConnection             dbConnection             = new SqlConnection(avanticaConnectionString);
            IAnuncioRepository        anuncioRepository        = new AnuncioRepository(dbConnection);
            IAnuncioDetalleRepository anuncioDetalleRepository = new AnuncioDetalleRepository(dbConnection);
            IUbicacionRepository      ubicacionRepository      = new UbicacionRepository(dbConnection);
            IUsuarioRepository        usuarioRepository        = new UsuarioRepository(dbConnection);
            ITipoPropiedadRepository  tipoPropiedadRepository  = new TipoPropiedadRepository(dbConnection);
            IEvaluacionRepository     evaluacionRepository     = new EvaluacionRepository(dbConnection);
            IImagenRepository         imagenRepository         = new ImagenRepository(dbConnection);
            IMapper                   mapper = new Mapper(
                new MapperConfiguration(
                    configure => { configure.AddProfile <AutoMapperProfiles>(); }
                    )
                );

            _anuncioService = new AnuncioService(anuncioRepository, anuncioDetalleRepository, usuarioRepository,
                                                 tipoPropiedadRepository, ubicacionRepository, evaluacionRepository, imagenRepository, mapper);

            ValidCreacionAnuncioRequest = AnuncioFake.GetCreacionAnuncioRequest();
            ValidEdicionAnuncioRequest  = AnuncioFake.GetEdicionAnuncioRequest();
        }
        public AnuncioControllerUnitTest()
        {
            _anuncioServiceMock = new Mock <IAnuncioService>();
            _usuarioServiceMock = new Mock <IUsuarioService>();

            ValidCreacionAnuncioRequest = AnuncioFake.GetCreacionAnuncioRequest();
            ValidEdicionAnuncioRequest  = AnuncioFake.GetEdicionAnuncioRequest();
        }
        private async Task <BaseServiceResponse <IEnumerable <AnuncioResponse> > > GetAnuncioResponseAsync(bool isValid)
        {
            BaseServiceResponse <IEnumerable <AnuncioResponse> > response = new BaseServiceResponse <IEnumerable <AnuncioResponse> >();

            if (!isValid)
            {
                response.Message = "No se pudo obtener la información del anuncio";
                return(response);
            }
            response.Data    = AnuncioFake.GetAnuncios();
            response.Message = "Se obtuvo existomante";
            response.Success = true;
            return(await Task.FromResult(response));
        }