예제 #1
0
        public ActionResult <CrearEmpleadoResponse> Post(CrearEmpleadoRequest request)
        {
            CrearEmpleadoService  _service = new CrearEmpleadoService(_unitOfWork);
            CrearEmpleadoResponse response = _service.Ejecutar(request);

            return(Ok(response));
        }
예제 #2
0
        private void CrearEmpleado()
        {
            empleadoService = new EmpleadoService(unitOfWork);
            var requestEmpleado = new CrearEmpleadoRequest {
                Cedula = "1065840833", Nombre = "Duvan", Salario = 1200000
            };

            empleadoService.CrearEmpleado(requestEmpleado);
        }
        public void CrearEmpladoTest(string cedula, string nombre, double salario, string mensajeEsperado)
        {
            var request = new CrearEmpleadoRequest {
                Cedula = cedula, Nombre = nombre, Salario = salario
            };
            CrearEmpleadoService _service = new CrearEmpleadoService(new UnitOfWork(_context));
            var response = _service.Ejecutar(request);

            Assert.AreEqual(mensajeEsperado, response.Mensaje);
        }
예제 #4
0
        public void RegistrarEmpleadoTest()
        {
            var request = new CrearEmpleadoRequest {
                Cedula = "98032461204", Nombre = "Duvan", Salario = 1200000
            };
            EmpleadoService _service = new EmpleadoService(new UnitOfWork(_context));
            var             response = _service.CrearEmpleado(request);

            Assert.AreEqual($"Se registro con exito el empleado Duvan.", response.Mensaje);
        }
예제 #5
0
        public void RegistrarEmpleadoRepetidoTest()
        {
            var request = new CrearEmpleadoRequest {
                Cedula = "1065840833", Nombre = "Duvan", Salario = 1200000
            };
            EmpleadoService _service = new EmpleadoService(new UnitOfWork(_context));

            _service.CrearEmpleado(request);
            var response = _service.CrearEmpleado(request);

            Assert.AreEqual($"El empleado con numero de cedula 1065840833 ya se encuentra registrado", response.Mensaje);
        }
        public void Setup()
        {
            /*var optionsSqlServer = new DbContextOptionsBuilder<BancoContext>()
             * .UseSqlServer("Server=.\\;Database=Banco;Trusted_Connection=True;MultipleActiveResultSets=true")
             * .Options;*/

            var optionsInMemory = new DbContextOptionsBuilder <BancoContext>().UseInMemoryDatabase("Creditos").Options;

            _context = new BancoContext(optionsInMemory);
            var requestEmpleado = new CrearEmpleadoRequest {
                Cedula = "1003195636", Nombre = "Ivan Contreras", Salario = 1000000
            };
            CrearEmpleadoService _serviceEmpleado = new CrearEmpleadoService(new UnitOfWork(_context));
            var responseEmpleado = _serviceEmpleado.Ejecutar(requestEmpleado);
        }
예제 #7
0
        public void SetUp()
        {
            /*var optionsSqlServer = new DbContextOptionsBuilder<BancoContext>()
             * .UseSqlServer("Server=.\\;Database=Banco;Trusted_Connection=True;MultipleActiveResultSets=true")
             * .Options;*/

            var optionsInMemory = new DbContextOptionsBuilder <LibranzasContext>().UseInMemoryDatabase("Libranzas").Options;

            _context             = new LibranzasContext(optionsInMemory);
            unitOfWork           = new UnitOfWork(_context);
            crearEmpleadoService = new EmpleadoService(unitOfWork);
            var request = new CrearEmpleadoRequest {
                Cedula = "1065840833", Nombre = "Duvan", Salario = 1200000
            };

            crearEmpleadoService.CrearEmpleado(request);
            crearCreditoService = new CreditoService(unitOfWork);
        }
예제 #8
0
        public ActionResult <Response> Post(CrearEmpleadoRequest request)
        {
            Response response = empleadoService.CrearEmpleado(request);

            return(Ok(response));
        }