示例#1
0
        private void UpdateOrderForAPI(Order order, bool sendsignalr = true)
        {
            OrderDTO orderDTO = _mapper.Map <Order, OrderDTO>(order);

            OrderAPI.UpdateOrder(orderDTO);
            try
            {
                if (sendsignalr && order.ReportBackToClient)
                {
                    OrderAPI.BroadCastMessage($"The status of your order for order number {order.OrderReferenceId} is {order.Status}.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#2
0
        public void OrderController_UpdateOrder_ReturnUpdateOrderMessage()
        {
            IOrderManager orderManager = new OrderManager();
            OrderAPI      _controller  = new OrderAPI(orderManager);

            Order _order = new Order
            {
                Id          = 123,
                Description = "test description",
                Price       = 1.50,
                Status      = OrderStatus.Active
            };

            string _response = _controller.UpdateOrder(_order);

            Assert.Equal("Order: 123 updated", _response);
        }