public async Task <IHttpActionResult> StartDelivery(Guid courierId, DeliveryDto delivery)
        {
            foreach (var order in delivery.Orders)
            {
                await OrderService.ChangeOrderStateAsync(order, OrderStateDto.Fulfillment);
            }
            await RouteService.AddRouteAsync(courierId, delivery.Route);

            await CourierService.ChangeCourierStateAsync(courierId, CourierStateDto.PerformsDelivery);

            return(Ok());
        }
Ejemplo n.º 2
0
        public void ChangeCourierState_CorrectData()
        {
            CourierDto courier = new CourierDto()
            {
                FirstName   = "Courier",
                LastName    = "change location",
                PhoneNumber = "testphone",
                Location    = new PointDto()
                {
                    Latitude = 23.02, Longitude = 54.03
                }
            };

            Guid id = courierService.AddCourierAsync(courier).Result;

            courierService.ChangeCourierStateAsync(id, CourierStateDto.Idle).Wait();

            courier = courierService.GetCourierById(id);

            Assert.IsTrue(courier.State == CourierStateDto.Idle);
        }