예제 #1
0
        public void PutModificarEstadodescripcionNull()
        {
            var logicMock                 = new Mock <IReserva>(MockBehavior.Strict);
            var logicMockHospedaje        = new Mock <IHospedaje>(MockBehavior.Strict);
            ReservasController controller = new ReservasController(logicMock.Object, logicMockHospedaje.Object);

            int           id     = 0;
            EstadoReserva estado = EstadoReserva.Aceptada;

            var result   = controller.PutEstado(id, null, estado);
            var okResult = result as BadRequestObjectResult;

            logicMock.VerifyAll();

            Assert.AreEqual(400, okResult.StatusCode);
        }
예제 #2
0
        public void PutModificarEstadoOk()
        {
            var logicMock                 = new Mock <IReserva>(MockBehavior.Strict);
            var logicMockHospedaje        = new Mock <IHospedaje>(MockBehavior.Strict);
            ReservasController controller = new ReservasController(logicMock.Object, logicMockHospedaje.Object);

            int           id     = 1;
            string        desc   = "test";
            EstadoReserva estado = EstadoReserva.Aceptada;

            logicMock.Setup(x => x.ModificarEstado(id, desc, estado));

            var result   = controller.PutEstado(id, desc, estado);
            var okResult = result as OkObjectResult;

            logicMock.VerifyAll();
        }
예제 #3
0
        public void PutModificarEstadoNoExiste()
        {
            var logicMock                 = new Mock <IReserva>(MockBehavior.Strict);
            var logicMockHospedaje        = new Mock <IHospedaje>(MockBehavior.Strict);
            ReservasController controller = new ReservasController(logicMock.Object, logicMockHospedaje.Object);

            int           id     = 0;
            string        desc   = "test";
            EstadoReserva estado = EstadoReserva.Aceptada;

            logicMock.Setup(x => x.ModificarEstado(id, desc, estado)).
            Throws(new EntidadNoExisteExcepcion());

            var result   = controller.PutEstado(id, desc, estado);
            var okResult = result as NotFoundObjectResult;

            logicMock.VerifyAll();

            Assert.AreEqual(404, okResult.StatusCode);
        }