Ejemplo n.º 1
0
        public async Task <IActionResult> Orders()
        {
            var query   = new GetAllOrders();
            var resuilt = await _mediator.Send(query);

            return(Ok(resuilt));
        }
Ejemplo n.º 2
0
        public void GetAllOrders_Action_Fails()
        {
            // Arrange
            GenericServiceResponse <IEnumerable <OrderDto> > fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.OrderService.GetAllOrders()).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericListViewModel <OrderDto>();

            var action = new GetAllOrders <GenericListViewModel <OrderDto> >(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericListViewModel <OrderDto>));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 1);
            Assert.IsTrue(result.HasErrors);
            Assert.IsNotNull(result.Items);
            Assert.IsTrue(result.Items.Count() == 0);
            Assert.IsInstanceOfType(result.Items, typeof(IEnumerable <OrderDto>));
            Assert.IsTrue(result.Items.ToList().Count() == 0);
        }
Ejemplo n.º 3
0
        public void testListAllOrders()
        {
            var getAllOrders = new GetAllOrders
                               (
                               );
            List <TransfluentOrder> orders = getAllOrders.Parse(justCall(getAllOrders));

            Assert.IsNotNull(orders);
            //Assert.Greater(orders.Count, 0);
        }
        public async Task <IEnumerable <Order> > Handle(GetAllOrders request, CancellationToken cancellationToken)
        {
            var response = await orderrepository.AllOrder();

            if (response == null)
            {
                return(null);
            }
            return(response);
        }
Ejemplo n.º 5
0
        private void LoadAsync(int orderId)
        {
            var userName = _userManager.GetUserId(User);

            Orders = new GetAllOrders(_context).Do(userName, orderId);
            if (orderId != -1)
            {
                ProductInOrders = new GetAllProductInOrder(_context).Do(Orders.FirstOrDefault(order => order.OrderId == orderId).OrderId);
                Products        = new GetAllProducts(_context).Do(0, 0)
                                  .Where(prod => ProductInOrders.Select(product => product.ProductRefId).Contains(prod.ProductId));
            }
        }
Ejemplo n.º 6
0
        public static List <Order> GetListOrder()
        {
            string url = Service.Properties.Settings.Default.Host + Service.Properties.Settings.Default.GetAllWithPizzasAndIngredients;

            GetAllOrders getAllOrders = Get <GetAllOrders>(url);

            foreach (Order order in getAllOrders.Orders)
            {
                order.Client = GetCustomerById(order.Id_Customer);
            }

            return(getAllOrders.Orders);
        }
Ejemplo n.º 7
0
            public async Task <IEnumerable <OrderSummary> > HandleAsync(GetAllOrders query, IReadOnlyMetadata metadata)
            {
                await Task.CompletedTask;

                return(new[] { new OrderSummary("66") });
            }
Ejemplo n.º 8
0
 public async Task <IEnumerable <Order> > HandleAsync(GetAllOrders query)
 {
     return(await _context.GetOrdersAsync(
                query.Page,
                query.PerPage));
 }
 public void OnGet()
 {
     Orders  = new GetAllOrders(_context).Do();
     UsersVM = _userManager.Users.AsNoTracking().AsEnumerable();
 }
Ejemplo n.º 10
0
 public void testListAllOrders()
 {
     var getAllOrders = new GetAllOrders
         (
         );
     List<TransfluentOrder> orders = getAllOrders.Parse(justCall(getAllOrders));
     Assert.IsNotNull(orders);
     //Assert.Greater(orders.Count, 0);
 }
 public IActionResult GetAll([FromQuery] GetAllOrders query) =>
 this.Process(query);