public void GetReservaIdNoExiste() { var logicMock = new Mock <IReserva>(MockBehavior.Strict); var logicMockHospedaje = new Mock <IHospedaje>(MockBehavior.Strict); ReservasController controller = new ReservasController(logicMock.Object, logicMockHospedaje.Object); logicMock.Setup(x => x.ObtenerPorId(It.IsAny <int>())).Throws(new EntidadNoExisteExcepcion()); var result = controller.GetPorId(It.IsAny <int>()); var okResult = result as NotFoundObjectResult; logicMock.VerifyAll(); }
public void GetReservaIdOk() { var logicMock = new Mock <IReserva>(MockBehavior.Strict); var logicMockHospedaje = new Mock <IHospedaje>(MockBehavior.Strict); ReservasController controller = new ReservasController(logicMock.Object, logicMockHospedaje.Object); logicMock.Setup(x => x.ObtenerPorId(It.IsAny <int>())).Returns(It.IsAny <Reserva>()); var result = controller.GetPorId(It.IsAny <int>()); var okResult = result as OkObjectResult; logicMock.VerifyAll(); }