Пример #1
0
        public IActionResult Update(string id, Vehiculo vehiculoIn)
        {
            var vehiculo = _vehiculoService.GetVehiculo(id);

            if (vehiculo == null)
            {
                return(NotFound());
            }
            _vehiculoService.Update(id, vehiculoIn);
            vehiculo = _vehiculoService.GetVehiculo(id);
            return(Ok(vehiculo));
        }
Пример #2
0
        public void UpdateVehiculo_True()
        {
            Vehiculo vehiculo = new Vehiculo();
            var      mockVehiculoRepository = new Mock <IVehiculoRepository>();

            mockVehiculoRepository.Setup(sp => sp.Update(vehiculo)).Returns(true);
            IVehiculoService vehiculoService = new VehiculoService(mockVehiculoRepository.Object);

            var resultado = vehiculoService.Update(vehiculo);

            Assert.True(resultado);
        }