Example #1
0
        public void TestAgregarVehiculoFallaValidacion()
        {
            validador.Setup(v => v.Validar(It.IsAny <DataVehiculo>())).Throws(new BusinessException("Validador error", "0001"));
            loggerDao.Setup(l => l.Agregar(It.IsAny <string>(), It.IsAny <string>())).Verifiable();

            Respuesta response = vehiculo.AgregarVehiculo(new DataVehiculo());

            validador.Verify(v => v.Validar(It.IsAny <DataVehiculo>()), Times.Once());
            loggerDao.Verify(l => l.Agregar(It.IsAny <string>(), It.IsAny <string>()), Times.Once());
            vehiculoDao.Verify(p => p.AgregarVehiculo(It.IsAny <DataVehiculo>()), Times.Never());

            Assert.IsNotNull(response);

            string cExpected  = Messages.CODIGO_RECHAZADO;
            string mExpected  = "Validador error";
            string csExpected = Business.SERVICIO_VEHICULOS + "0001";

            Assert.AreEqual(cExpected, response.Codigo);
            Assert.AreEqual(mExpected, response.Mensaje);
            Assert.AreEqual(csExpected, response.CodigoServicio);

            validador.VerifyAll();
            loggerDao.VerifyAll();
            vehiculoDao.VerifyAll();
        }
Example #2
0
 public Respuesta AgregarVehiculo(DataVehiculo data)
 {
     log.Info("Agregar vehiculo : " + data);
     return(vehiculo.AgregarVehiculo(data));
 }