public async Task <BookingResponseAM> CalculateBooking(BookingRequestAM request) { var result = new BookingResponseAM(); var firstWaypointCoordinate = request.Waypoints.Points.First().ToCoordinate(); var rootAddresses = await AddressService.GetNearestAddresses(AddressKind.City, firstWaypointCoordinate); var possibleRoutes = await RouteService.GetPossibleRoutes(rootAddresses, request.Waypoints); var bookingRoutes = await GetBookingRoutes(possibleRoutes, request.Cargo, request.Basket); result.Routes.AddRange(bookingRoutes); return(result); }
public async Task Calculate() { var bookingRequest = new BookingRequestAM(); var bookingResponse = new BookingResponseAM(); Suite.ApplicationServiceMock .Setup(m => m.CalculateBooking(bookingRequest)) .ReturnsAsync(bookingResponse); var result = await Suite.Controller.Calculate(bookingRequest); Suite.ApplicationServiceMock .Verify(m => m.CalculateBooking(bookingRequest)); Assert.Equal(bookingResponse, result); }
public Task <BookingResponseAM> Calculate([FromBody] BookingRequestAM request) { return(Service.CalculateBooking(request)); }