Ejemplo n.º 1
0
        public void AddCurrentRoute_CorrectData_RouteCreated()
        {
            CourierDto courier = new CourierDto()
            {
                FirstName   = "Courier",
                LastName    = "With route",
                PhoneNumber = "test"
            };

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

            RouteDto route = new RouteDto()
            {
                Created = DateTime.Now,
                Points  = new List <PointDto>
                {
                    new PointDto {
                        Latitude = 49.8333981, Longitude = 24.0125249
                    },
                    new PointDto {
                        Latitude = 49.8306805, Longitude = 24.034673
                    },
                    new PointDto {
                        Latitude = 49.8388715, Longitude = 24.0311097
                    }
                }
            };

            Guid routeId = routeService.AddRouteAsync(id, route).Result;

            Assert.IsTrue(routeId != Guid.Empty);
        }
        private long PrepareData()
        {
            CourierDto[] couriers = new CourierDto[]
            {
                CourierFactory(new PointDto(49.83498756, 24.03488874)),
                CourierFactory(new PointDto(49.83609475, 24.02265787)),
                CourierFactory(new PointDto(49.84495134, 24.03587579)),
                CourierFactory(new PointDto(49.84401041, 23.98257493)),
                CourierFactory(new PointDto(49.82712580, 23.98296117)),
                CourierFactory(new PointDto(49.82014880, 23.98823976)),
                CourierFactory(new PointDto(49.82390000, 24.02079100)),
                CourierFactory(new PointDto(49.83226000, 24.01255100))
            };

            foreach (var courier in couriers)
            {
                courierService.AddCourierAsync(courier).Wait();
            }

            var warehouseId = warehouseService.AddWarehouseAsync(new WarehouseDto()
            {
                Location = new PointDto(49.83425819, 24.01567876), Name = "Warehouse for order"
            }).Result;

            var order = OrderFactory(new PointDto(49.830213, 24.030651), warehouseId);

            long orderId = orderService.AddOrderAsync(order).Result;

            return(orderId);
        }
Ejemplo n.º 3
0
        public void AddCourierWithLocation_CorrectData_NewCourierIdIsExists()
        {
            CourierDto courier = new CourierDto()
            {
                FirstName   = "Courier",
                LastName    = "One",
                PhoneNumber = "testphone",
                Location    = new PointDto()
                {
                    Latitude = 23.02, Longitude = 54.03
                }
            };

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

            courier = courierService.GetCourierById(id);

            Assert.IsNotNull(courier);
        }