public ActionResult FacturarTest([PexAssumeUnderTest] PedidoController target, tbPedido Pedido)
        {
            ActionResult result = target.Facturar(Pedido);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.FacturarTest(PedidoController, tbPedido)
        }
Ejemplo n.º 2
0
 public void GuardarPedidoDetalleTest56()
 {
     using (PexDisposableContext disposables = PexDisposableContext.Create())
     {
         PedidoController pedidoController;
         JsonResult       jsonResult;
         pedidoController = new PedidoController();
         ((Controller)pedidoController).Resolver         = (IDependencyResolver)null;
         ((Controller)pedidoController).ActionInvoker    = (IActionInvoker)null;
         ((Controller)pedidoController).TempDataProvider = (ITempDataProvider)null;
         ((Controller)pedidoController).Url = (UrlHelper)null;
         ((Controller)pedidoController).ViewEngineCollection =
             (ViewEngineCollection)null;
         ((ControllerBase)pedidoController).ControllerContext = (ControllerContext)null;
         ((ControllerBase)pedidoController).TempData          = (TempDataDictionary)null;
         ((ControllerBase)pedidoController).ValidateRequest   = false;
         ((ControllerBase)pedidoController).ValueProvider     = (IValueProvider)null;
         ((ControllerBase)pedidoController).ViewData          = (ViewDataDictionary)null;
         disposables.Add((IDisposable)pedidoController);
         jsonResult =
             this.GuardarPedidoDetalleTest(pedidoController, (tbPedidoDetalle)null);
         disposables.Dispose();
         Assert.IsNotNull((object)pedidoController);
         Assert.IsNotNull(((Controller)pedidoController).AsyncManager);
         Assert.IsNotNull
             (((Controller)pedidoController).AsyncManager.OutstandingOperations);
         Assert.IsNotNull(((Controller)pedidoController).AsyncManager.Parameters);
         Assert.AreEqual <int>
             (45000, ((Controller)pedidoController).AsyncManager.Timeout);
         Assert.IsNull(((Controller)pedidoController).Url);
         Assert.IsNull(((ControllerBase)pedidoController).ControllerContext);
         Assert.AreEqual <bool>
             (false, ((ControllerBase)pedidoController).ValidateRequest);
     }
 }
 public void PedidoDetalle_SaveTest()
 {
     using (PexDisposableContext disposables = PexDisposableContext.Create())
     {
         PedidoController  pedidoController;
         JsonResult        jsonResult;
         ControllerContext s0 = new ControllerContext();
         s0.Controller  = (ControllerBase)null;
         s0.HttpContext = (HttpContextBase)null;
         RequestContext s1 = new RequestContext();
         s1.HttpContext    = (HttpContextBase)null;
         s1.RouteData      = (RouteData)null;
         s0.RequestContext = s1;
         s0.RouteData      = (RouteData)null;
         pedidoController  = new PedidoController();
         ((Controller)pedidoController).Resolver         = (IDependencyResolver)null;
         ((Controller)pedidoController).ActionInvoker    = (IActionInvoker)null;
         ((Controller)pedidoController).TempDataProvider = (ITempDataProvider)null;
         ((Controller)pedidoController).Url = (UrlHelper)null;
         ((Controller)pedidoController).ViewEngineCollection =
             (ViewEngineCollection)null;
         ((ControllerBase)pedidoController).ControllerContext = s0;
         ((ControllerBase)pedidoController).TempData          = (TempDataDictionary)null;
         ((ControllerBase)pedidoController).ValidateRequest   = false;
         ((ControllerBase)pedidoController).ValueProvider     = (IValueProvider)null;
         ((ControllerBase)pedidoController).ViewData          = (ViewDataDictionary)null;
         disposables.Add((IDisposable)pedidoController);
         jsonResult =
             this.SavePedidoDetallesTest(pedidoController, (tbPedidoDetalle)null);
         disposables.Dispose();
     }
 }
Ejemplo n.º 4
0
        public async void GetAll_test()
        {
            //Given
            var queryMock   = new Mock <IPedidoQuery>();
            var commandMock = new Mock <IPedidoCommand>();

            var mocker             = new AutoMoqer();
            var baseControllerMock = new PedidoController(commandMock.Object, queryMock.Object, "User");

            var faker = AutoFaker.Create();

            var response = faker.Generate <List <PedidoEntity> >();

            var expectResponse = baseControllerMock.Ok(response);

            queryMock.Setup(r => r.GetAll()).ReturnsAsync(response).Verifiable();

            //When
            var result = await baseControllerMock.GetAll();

            //Then
            var comparison = new CompareLogic();

            queryMock.Verify(mock => mock.GetAll(), Times.Once());
            Assert.True(comparison.Compare(result, expectResponse).AreEqual);
        }
Ejemplo n.º 5
0
        public async void GetAll_test_InternalServerError()
        {
            //Given
            var queryMock   = new Mock <IPedidoQuery>();
            var commandMock = new Mock <IPedidoCommand>();

            var mocker             = new AutoMoqer();
            var baseControllerMock = new PedidoController(commandMock.Object, queryMock.Object, "User");

            var faker = AutoFaker.Create();

            var response = new Exception();

            var expectResponse = baseControllerMock.StatusCode(500);

            queryMock.Setup(r => r.GetAll()).ThrowsAsync(response).Verifiable();

            //When
            var result = await baseControllerMock.GetAll();

            //Then
            //var comparison = new CompareLogic();
            queryMock.Verify(mock => mock.GetAll(), Times.Once());
            Assert.True(((ObjectResult)result).StatusCode == expectResponse.StatusCode);
        }
        public JsonResult getPedidoDetalleTest([PexAssumeUnderTest] PedidoController target, int pedd_Id)
        {
            JsonResult result = target.getPedidoDetalle(pedd_Id);

            return(result);
            // TODO: add assertions to method PedidoControllerTest.getPedidoDetalleTest(PedidoController, Int32)
        }
Ejemplo n.º 7
0
        protected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "cancelar":
                ImageButton btn      = (ImageButton)e.CommandSource;
                GridViewRow gvr      = (GridViewRow)btn.NamingContainer;
                String      username = (string)gv.DataKeys[gvr.RowIndex].Value;
                if (ViewState["username"].ToString().ToLower() == username.ToLower().ToString())
                {
                    if (PedidoController.Cancelar(Convert.ToInt32(e.CommandArgument)))
                    {
                        Mensaje(true, "El pedido fue cancelado");
                    }
                    else
                    {
                        Mensaje(false, "", "El pedido No puede ser cancelado si esta preparandose o fue encargado");
                    }
                }
                else
                {
                    Mensaje(false, "", "El pedido solo puede ser cancelado por el usuario que lo solicito.");
                }


                break;
            }
            CargaGrilla();
            CalcularSubtotal();
        }
        public JsonResult GuardarPedidoDetalleTestx([PexAssumeUnderTest] PedidoController target, tbPedidoDetalle PedidoDetalles)
        {
            JsonResult result = target.GuardarPedidoDetalle(PedidoDetalles);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.GuardarPedidoDetalleTest(PedidoController, tbPedidoDetalle)
        }
        public PedidoController ConstructorTest()
        {
            PedidoController target = new PedidoController();

            return(target);
            // TODO: add assertions to method PedidoControllerTest.ConstructorTest()
        }
Ejemplo n.º 10
0
        public ActionResult EditTest([PexAssumeUnderTest] PedidoController target, int?id)
        {
            ActionResult result = target.Edit(id);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.EditTest(PedidoController, Nullable`1<Int32>)
        }
Ejemplo n.º 11
0
        public ActionResult CreateTest01([PexAssumeUnderTest] PedidoController target, tbPedido tbPedido)
        {
            ActionResult result = target.Create(tbPedido);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.CreateTest01(PedidoController, tbPedido)
        }
Ejemplo n.º 12
0
        public ActionResult DeleteConfirmedTest([PexAssumeUnderTest] PedidoController target, int id)
        {
            ActionResult result = target.DeleteConfirmed(id);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.DeleteConfirmedTest(PedidoController, Int32)
        }
        public PedidoController ConstructorTest()
        {
            PedidoController target = new PedidoController();

            return(target);
            // TODO: agregar aserciones a método PedidoControllerTest.ConstructorTest()
        }
        public JsonResult GetDetallePedidoTest([PexAssumeUnderTest] PedidoController target, int pedido)
        {
            JsonResult result = target.GetDetallePedido(pedido);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.GetDetallePedidoTest(PedidoController, Int32)
        }
Ejemplo n.º 15
0
        public JsonResult GuardarPedidoDetalleTest([PexAssumeUnderTest] PedidoController target, tbPedidoDetalle PedidoDetalles)
        {
            JsonResult result = target.GuardarPedidoDetalle(PedidoDetalles);

            return(result);
            // TODO: add assertions to method PedidoControllerTest.GuardarPedidoDetalleTest(PedidoController, tbPedidoDetalle)
        }
Ejemplo n.º 16
0
        public JsonResult SavePedidoDetallesTest([PexAssumeUnderTest] PedidoController target, tbPedidoDetalle PedidoDetalle)
        {
            JsonResult result = target.SavePedidoDetalles(PedidoDetalle);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.SavePedidoDetallesTest(PedidoController, tbPedidoDetalle)
        }
Ejemplo n.º 17
0
        public ActionResult IndexPedidoTest([PexAssumeUnderTest] PedidoController target)
        {
            ActionResult result = target.IndexPedido();

            return(result);
            // TODO: add assertions to method PedidoControllerTest.IndexPedidoTest(PedidoController)
        }
Ejemplo n.º 18
0
        public ActionResult UpdatePedidoDetalleTest([PexAssumeUnderTest] PedidoController target, tbPedidoDetalle EditPedidoDetalle)
        {
            ActionResult result = target.UpdatePedidoDetalle(EditPedidoDetalle);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.UpdatePedidoDetalleTest(PedidoController, tbPedidoDetalle)
        }
Ejemplo n.º 19
0
        static void Main(string[] args)
        {
            PedidoController pedido = new PedidoController();

            pedido.lerPedido();
            pedido.revisaoPedido();
        }
Ejemplo n.º 20
0
        public ActionResult _IndexProductoTest([PexAssumeUnderTest] PedidoController target)
        {
            ActionResult result = target._IndexProducto();

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest._IndexProductoTest(PedidoController)
        }
Ejemplo n.º 21
0
        public void Register_Retorna_CreatedResult()
        {
            var itens = new List <Item>()
            {
                new Item(1, "Item A", 10, 1),
                new Item(2, "Item B", 5, 2)
            };

            var createPedidoModel = new CreatePedidoModel()
            {
                Id              = 1,
                Itens           = itens,
                Pedido          = "123456",
                PedidoExistente = false
            };

            var mock = new Mock <IServicePedido>();

            mock.Setup(it => it.Insert(createPedidoModel)).Returns(new PedidoModel(0));

            var pedidoController = new PedidoController(mock.Object);

            var result = pedidoController.Register(createPedidoModel) as CreatedResult;

            Assert.Equal(201, result.StatusCode);
        }
Ejemplo n.º 22
0
        public JsonResult getPedidoDetalleTestx([PexAssumeUnderTest] PedidoController target, int pedd_Id)
        {
            JsonResult result = target.getPedidoDetalle(pedd_Id);

            return(result);
            // TODO: agregar aserciones a método PedidoControllerTest.getPedidoDetalleTest(PedidoController, Int32)
        }
Ejemplo n.º 23
0
        public async void GetAll_test_NotFound()
        {
            //Given
            var queryMock   = new Mock <IPedidoQuery>();
            var commandMock = new Mock <IPedidoCommand>();

            var mocker             = new AutoMoqer();
            var baseControllerMock = new PedidoController(commandMock.Object, queryMock.Object, "User");

            var faker = AutoFaker.Create();

            var response = new List <PedidoEntity>();

            var expectResponse = baseControllerMock.NotFound(response);

            queryMock.Setup(r => r.GetAll()).ReturnsAsync(response).Verifiable();

            //When
            var result = await baseControllerMock.GetAll();

            //Then
            //var comparison = new CompareLogic();
            queryMock.Verify(mock => mock.GetAll(), Times.Once());
            Assert.True(((NotFoundResult)result).StatusCode == ((NotFoundObjectResult)expectResponse).StatusCode);
        }
Ejemplo n.º 24
0
        public ActionResult EditPedidoTest([PexAssumeUnderTest] PedidoController target, int?id)
        {
            ActionResult result = target.EditPedido(id);

            return(result);
            // TODO: add assertions to method PedidoControllerTest.EditPedidoTest(PedidoController, Nullable`1<Int32>)
        }
Ejemplo n.º 25
0
        public async void Cadastrar_test_InternalServerError()
        {
            //Given

            var queryMock   = new Mock <IPedidoQuery>();
            var commandMock = new Mock <IPedidoCommand>();

            var faker = AutoFaker.Create();

            var param = faker.Generate <PedidoParam>();

            var baseControllerMock = new PedidoController(commandMock.Object, queryMock.Object, "User");
            var expectResponse     = baseControllerMock.StatusCode(500);


            commandMock.Setup(r => r.InserirPedido(It.IsAny <PedidoParam>())).ThrowsAsync(new Exception()).Verifiable();

            //When

            var result = await baseControllerMock.Cadastrar(param);

            //Then
            //var comparison = new CompareLogic();
            commandMock.Verify(mock => mock.InserirPedido(It.IsAny <PedidoParam>()), Times.Once());
            Assert.True(((ObjectResult)result).StatusCode == expectResponse.StatusCode);
        }
Ejemplo n.º 26
0
        public ActionResult FacturarTest([PexAssumeUnderTest] PedidoController target, tbPedido Pedido)
        {
            ActionResult result = target.Facturar(Pedido);

            return(result);
            // TODO: add assertions to method PedidoControllerTest.FacturarTest(PedidoController, tbPedido)
        }
 private void btAceptar_Click(object sender, RoutedEventArgs e)
 {
     if (Flag)
     {
         PedidoController controller = new PedidoController();
         ResultadoOperacionEnum.ResultadoOperacion resultado = controller.CancelarPedido(LocalPedido);
         if (resultado == ResultadoOperacionEnum.ResultadoOperacion.Exito)
         {
             MessageBox.Show("Pedido Cancelado");
         }
         else if (resultado == ResultadoOperacionEnum.ResultadoOperacion.FalloSQL)
         {
             MessageBox.Show("Error con la base de datos, reintentar mas tarde");
         }
         this.Close();
     }
     else
     {
         PedidoController controller = new PedidoController();
         ResultadoOperacionEnum.ResultadoOperacion resultado = controller.CancelarPedido(LocalPedido);
         if (resultado == ResultadoOperacionEnum.ResultadoOperacion.Exito)
         {
             MessageBox.Show("Pedido Cancelado");
         }
         else if (resultado == ResultadoOperacionEnum.ResultadoOperacion.FalloSQL)
         {
             MessageBox.Show("Error con la base de datos, reintentar mas tarde");
         }
         this.Close();
     }
 }
Ejemplo n.º 28
0
        public JsonResult GetDetallePedidoTest([PexAssumeUnderTest] PedidoController target, int pedido)
        {
            JsonResult result = target.GetDetallePedido(pedido);

            return(result);
            // TODO: add assertions to method PedidoControllerTest.GetDetallePedidoTest(PedidoController, Int32)
        }
Ejemplo n.º 29
0
        public async void Cadastrar_test()
        {
            //Given

            var queryMock   = new Mock <IPedidoQuery>();
            var commandMock = new Mock <IPedidoCommand>();

            var faker = AutoFaker.Create();

            var param = faker.Generate <PedidoParam>();

            var response = "Pedido realizado com sucesso!";

            var baseControllerMock = new PedidoController(commandMock.Object, queryMock.Object, "User");
            var expectResponse     = baseControllerMock.Ok(response);


            commandMock.Setup(r => r.InserirPedido(It.IsAny <PedidoParam>())).ReturnsAsync(true).Verifiable();

            //When

            var result = await baseControllerMock.Cadastrar(param);

            //Then
            var comparison = new CompareLogic();

            commandMock.Verify(mock => mock.InserirPedido(It.IsAny <PedidoParam>()), Times.Once());
            Assert.True(comparison.Compare(result, expectResponse).AreEqual);
        }
Ejemplo n.º 30
0
        public void PreencheGrid()
        {
            PedidoController Controller = new PedidoController();

            this.GVPedido.DataSource = Controller.SelecionarTodosPedido();
            this.GVPedido.DataBind();
        }