public ActionResult Detalles()
        {
            int id;

            int.TryParse(Request.QueryString["idPaquete"], out id);

            return(View(PaqueteService.GetPaquete(id)));
        }
예제 #2
0
        public ActionResult Editar(long id)
        {
            if (AutorizarAdmin())
            {
                ViewBag.Accion = "Editar";

                return(View(PaqueteService.GetPaquete(id)));
            }
            else
            {
                return(Redirect(UrlLogin));
            }
        }
예제 #3
0
        public void GetByIdInvalido()
        {
            //Arrange
            int id = new Random().Next(6, 100);

            PaqueteService service = new PaqueteService(_repository.Object, _query.Object);

            //Act
            var result = service.GetPaquete(id);

            //Assert
            Assert.IsNull(result);
        }
예제 #4
0
        public void GetByIdValido()
        {
            //Arrange
            int id = new Random().Next(1, 5);

            _query.Setup(_ => _.GetPaquete(id)).Returns(new ResponsePaqueteDto()
            {
                TipoPaquete = 3.ToString(),
                Peso        = 0,
                Largo       = 0,
                Ancho       = 0,
                Alto        = 0
            });

            PaqueteService service = new PaqueteService(_repository.Object, _query.Object);

            //Act
            var result = service.GetPaquete(id);

            //Assert
            Assert.IsNotNull(result);
        }