public void PruebaParaValidarSiMascotaExisteParaEliminar()
        {
            var mascota = new Mascota();
            var id      = new int();

            mascota = null;

            var mascotaDomainService = new MascotaDomainService();
            var resultado            = mascotaDomainService.DeleteMascotaDomainService(id, mascota);

            Assert.AreEqual("La mascota no existe.", resultado);
        }
示例#2
0
        public async Task <string> DeleteMascotaApplicationService(int id)
        {
            var mascota = await _baseDatos.Mascotas.FindAsync(id);

            var respuestaDomainService = _mascotaDomainService.DeleteMascotaDomainService(id, mascota);

            bool hayErrorDomainService = respuestaDomainService != null;

            if (hayErrorDomainService)
            {
                return(respuestaDomainService);
            }

            _baseDatos.Mascotas.Remove(mascota);
            await _baseDatos.SaveChangesAsync();

            return(null);
        }