/// <summary> /// Generates daily visit data /// </summary> /// <param name="currentDate">visit date of customer</param> public void GenerateDailyVisits(DateTime currentDate) { //Prepare visitors and restaurants to choose var customers = _customerService.Get(new GetCustomerRequest()).Customers; var restaurants = _restaurantService.Get(new GetRestaurantRequest()).Restaurants; var menu = new List <FoodDTO>(); //Choose candidates var candidateVisitors = ChooseVisitors(customers); var candidateRestaurant = ChooseRestaurant(); //Make an reservation var reservationId = MakeReservation(candidateVisitors, candidateRestaurant, currentDate); //Visit the restaurant var visitId = Visit(reservationId, currentDate); //Give food orders var orderId = GiveFoodOrder(visitId, menu); //GetDeliveredFoods GetDeliveredFoods(orderId); Leave(currentDate, visitId); }
public async Task <ActionResult <List <Restaurant> > > Get() { var restaurents = await _restaurantService.Get(); if (restaurents.Count == 0) { return(NotFound("Restaurant is not found")); } return(Ok(restaurents)); }
/// <summary> /// Create product start-up stock mappings for all restaurants /// </summary> public void SetDefaultStockList() { //Get all restaurants from data source var restaurants = _restaurantService.Get(new GetRestaurantRequest()).Restaurants; var restaurantCount = restaurants.Count; //Get all products from data source var products = _productService.Get(new GetProductsRequest()).Products; var productsCount = products.Count; //For each restaurant Parallel.ForEach(restaurants, restaurant => { //For each products Parallel.ForEach(products, product => { _supplyService.CreateRestaurantProductMappings(new CreateRestaurantProductMappingRequest { RestaurantID = restaurant.ID, ProductID = product.ID, ExpectedStockAmount = RandomHelper.RandomDouble(Constants.ExpectedStockAmount.Min, Constants.ExpectedStockAmount.Max) }); }); }); }
public void GetById_GivenId_ReturnsCorrectRestaurant() { var restaurant = _restaurantService.Get().First(); var restaurantById = _restaurantService.Get(restaurant.RestaurantPublicId); Assert.AreEqual(restaurantById, restaurant); }
/// <summary> /// Builds request that contains random generated staff list /// </summary> /// <param name="count">how many staff will be created</param> /// <returns>instance of CreateStaffRequest</returns> private CreateStaffRequest BuildCreateStaffRequest(int count) { List <StaffDTO> staffs = new List <StaffDTO>(); var getRestaurantResponse = _restaurantService.Get(new GetRestaurantRequest()); for (int i = 0; i < count; i++) { staffs.Add(GenerateStaff(getRestaurantResponse.Restaurants)); } return(new CreateStaffRequest() { Staffs = staffs }); }
public ActionResult <List <Restaurant> > Get() => _restaurantService.Get();
public void Get_GivenRestaurantId_CallsRepositoryMethod() { _restaurantService.Get(Guid.NewGuid()); _mockRepository.Verify(x => x.GetById(It.IsAny <Guid>()), Times.AtLeastOnce); }
public async Task <IEnumerable <Restaurant> > Get() { var restaurants = await _restaurantService.Get(); return(restaurants); }