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); }
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(); }
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); }