示例#1
0
        public void CitaService_RegistrarCita_ValidacionCitaMismoDia_RetornaValidacion()
        {
            /// Arrange
            Cita cita = new Cita {
                Id = 0, Fecha = DateTime.Now, PacienteId = 1, TipoCitaId = 1, Paciente = new Paciente {
                    Id = 1, Documento = 123456
                }
            };


            citaRepository = new StubIRepository <Cita>
            {
                SelectExpressionOfFuncOfT0Boolean = (query) => new List <Cita> {
                    new Cita {
                        Id = 1, Fecha = DateTime.Now, PacienteId = 1, TipoCitaId = 1, Paciente = new Paciente {
                            Id = 1, Documento = 123456
                        }
                    }
                },
                InsertT0 = (entidad) => { }
            };

            citaService = new CitaService(citaRepository);

            /// Act
            var result = citaService.RegistrarCita(cita);

            /// Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result, "No se puede crear otra cita para el paciente en el mismo día.", "Se recibe la correcta validación");
        }
示例#2
0
        public void CitaService_RegistrarCita_NuevaCita_RetornaOk()
        {
            /// Arrange
            Cita cita = new Cita {
                Id = 0, Fecha = DateTime.Now, PacienteId = 1, TipoCitaId = 1, Paciente = new Paciente {
                    Id = 1, Documento = 123456
                }
            };


            citaRepository = new StubIRepository <Cita> {
                SelectExpressionOfFuncOfT0Boolean = (query) => new List <Cita> {
                },
                InsertT0 = (entidad) => { }
            };

            citaService = new CitaService(citaRepository);

            /// Act
            var result = citaService.RegistrarCita(cita);

            /// Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result, string.Empty, "La cita se registro correctamente");
        }
示例#3
0
        public void GestionCitasController_GetCitas_RetornaListaOk()
        {
            /// Arrange

            List <Cita> listaCitas = new List <Cita>();

            listaCitas.Add(new Cita {
                Id = 1, Fecha = DateTime.Now, PacienteId = 1, TipoCitaId = 1
            });
            listaCitas.Add(new Cita {
                Id = 2, Fecha = DateTime.Now, PacienteId = 1, TipoCitaId = 1
            });
            citaService = new StubICitaService
            {
                GetCitas = () => listaCitas
            };

            controller = new GestionCitasController(citaService, pacienteService, tipoCitaService);

            /// Act
            List <Cita> result = (List <Cita>)controller.GetCitas();

            /// Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result.Count, 2, "La cantidad de citas obtenidas deben ser 2");
        }
示例#4
0
 public CitasController(ICitaService service, IParametroService parametroService, IUsuariosService usuariosService, IUbicacionService ubicacionService, IErrorHandler errorHandler)
 {
     this.myService          = service;
     this.myParametroService = parametroService;
     this.myUsuariosService  = usuariosService;
     this.myUbicacionService = ubicacionService;
     this.myErrorHandler     = errorHandler;
 }
示例#5
0
 public CitaController(
     ICitaService citaService,
     IMedicoService medicoService,
     ISalaService salaService,
     ITipoServicioService tipoServicioService,
     IPacienteService pacienteService)
 {
     _citaService         = citaService;
     _medicoService       = medicoService;
     _salaService         = salaService;
     _tipoServicioService = tipoServicioService;
     _pacienteService     = pacienteService;
     _horarios            = new List <SelectListItem>();
 }
示例#6
0
        public void GestionCitasController_GetCitas_RetornaExcepcion()
        {
            /// Arrange

            citaService = new StubICitaService
            {
                GetCitas = () => { throw new ArgumentNullException(); }
            };

            controller = new GestionCitasController(citaService, pacienteService, tipoCitaService);

            /// Act
            List <Cita> result = (List <Cita>)controller.GetCitas();

            /// Assert
            Assert.IsInstanceOfType(result, typeof(ExceptionResult), "Se debe retornar una excepción");
        }
示例#7
0
        public void GestionCitasController_RegistrarCita_RetornaOk()
        {
            /// Arrange

            Cita cita = new Cita {
                Id = 1, Fecha = DateTime.Now, PacienteId = 1, TipoCitaId = 1
            };

            citaService = new StubICitaService
            {
                RegistrarCitaCita = (citaObj) => string.Empty
            };

            controller = new GestionCitasController(citaService, pacienteService, tipoCitaService);

            /// Act
            var result = controller.RegistrarCita(cita) as OkNegotiatedContentResult <string>;

            /// Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result.Content, string.Empty, "La cita se registro correctamente");
        }
示例#8
0
        public void GestionCitasController_RegistrarCita_RetornaValidacion()
        {
            /// Arrange

            Cita cita = new Cita {
                Id = 1, Fecha = DateTime.Now, PacienteId = 1, TipoCitaId = 1
            };
            string mensaje = "No se puede registrar la cita";

            citaService = new StubICitaService
            {
                RegistrarCitaCita = (citaObj) => mensaje
            };

            controller = new GestionCitasController(citaService, pacienteService, tipoCitaService);

            /// Act
            var result = controller.RegistrarCita(cita) as OkNegotiatedContentResult <string>;

            /// Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result.Content, mensaje, "Se debe recibir un mensaje de validación");
        }
示例#9
0
        public void CitaService_RegistrarCita_CitaExistente_RetornaOk()
        {
            /// Arrange
            Cita cita = new Cita {
                Id = 1, Fecha = DateTime.Now, PacienteId = 1, TipoCitaId = 1, Paciente = new Paciente {
                    Id = 1, Documento = 123456
                }
            };


            citaRepository = new StubIRepository <Cita>
            {
                UpdateT0 = (entidad) => { }
            };

            citaService = new CitaService(citaRepository);

            /// Act
            var result = citaService.RegistrarCita(cita);

            /// Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result, string.Empty, "La cita se actualizo correctamente");
        }
 public CitaController(
     ICitaService citaService
     )
 {
     _citaService = citaService;
 }
 public CitaController(ICitaService CitaService)
 {
     _CitaService = CitaService;
 }
示例#12
0
 public GestionCitasController(ICitaService citaService, IPacienteService pacienteService, ITipoCitaService tipoCitaService)
 {
     _citaService     = citaService;
     _pacienteService = pacienteService;
     _tipoCitaService = tipoCitaService;
 }
示例#13
0
 public CitaController(ICitaService CitaService)
 {
     this.CitaService = CitaService;
 }
示例#14
0
 public CitaController(ICitaService citaService, IMapper mapper)
 {
     this.citaService = citaService;
     this.mapper      = mapper;
 }
示例#15
0
 public CitaController(ICitaService citaService)
 {
     this.citaService = citaService;
 }