Exemplo n.º 1
0
 public void OpenRides()
 {
     foreach (var ride in rideRepo.All().Where(ride => ride.Status.Equals(RideStatus.Closed)))
     {
         ride.ToOpen();
         logger.LogInformation($"Ride {ride.Name} opened");
         CheckRequiredEmployees(ride);
     }
 }
Exemplo n.º 2
0
        public void All_GivenRepoHasTwoLocations_ExpectTwoLocations()
        {
            ConcurrentBag <LocationImpl> locations = repo.All();

            Assert.NotEmpty(locations);
            Assert.Equal(2, locations.Count);
        }
Exemplo n.º 3
0
        public string PlaceOrder(Guid standGuid, List <string> products)
        {
            var stand = standRepo.All().First(s => s.Guid.Equals(standGuid));

            var dinner = new Dinner(
                stand.Meals.FindAll(meal => products.Contains(meal.Name)),
                stand.Drinks.FindAll(drink => products.Contains(drink.Name))
                );

            if (!dinner.IsValid())
            {
                logger.Log(LogLevel.Error, $"Could not place order for {dinner.ToString()}");
                throw new InvalidOperationException($"Dinner is invalid: {dinner.ToString()}");
            }

            var ticket = Guid.NewGuid();

            var dateTime = GetDinnerDoneDateTime();

            openDinnerOrders.Add(ticket, dinner);
            ordersDoneAtTime.Add(ticket, dateTime);

            logger.Log(LogLevel.Debug, $"Placed order at stand {stand.Name} with ticket {ticket}, " +
                       $"done at {dateTime}");

            return(ticket.ToString());
        }
Exemplo n.º 4
0
 public StandControl(ILogger <StandControl> logger, IEventProducer eventProducer, ILocationService locationService)
 {
     this.logger        = logger;
     this.eventProducer = eventProducer;
     standRepo          = new LocationRepository <Stand>(locationService,
                                                         new LocationConverter <Stand>((x) => new Stand(x)));
     locationService.CalculateLocationDistances(standRepo.All());
 }
Exemplo n.º 5
0
 public RideControl(ILogger <RideControl> logger, IEventProducer eventProducer, IVisitorClient visitorClient,
                    ILocationService locationService)
 {
     rideRepo = new LocationRepository <Ride>(locationService,
                                              new LocationConverter <Ride>((x) => new Ride(x)));
     this.logger        = logger;
     this.eventProducer = eventProducer;
     this.visitorClient = visitorClient;
     locationService.CalculateLocationDistances(rideRepo.All());
 }
Exemplo n.º 6
0
        public FairyTaleControl(ILogger <FairyTaleControl> logger, IEventProducer eventProducer,
                                ILocationService locationService)
        {
            taleRepo = new LocationRepository <FairyTale>(locationService,
                                                          new LocationConverter <FairyTale>((obj) => new FairyTale(obj)));

            this.logger        = logger;
            this.eventProducer = eventProducer;

            locationService.CalculateLocationDistances(taleRepo.All());
        }
Exemplo n.º 7
0
 public StandControl(ILogger <StandControl> logger, IEventProducer eventProducer,
                     Dictionary <Guid, Dinner> openDinnerOrders, Dictionary <Guid, DateTime> ordersDoneAtTime, ILocationService locationService)
 {
     this.logger           = logger;
     this.eventProducer    = eventProducer;
     this.openDinnerOrders = openDinnerOrders;
     this.ordersDoneAtTime = ordersDoneAtTime;
     standRepo             = new LocationRepository <Stand>(locationService,
                                                            new LocationConverter <Stand>((x) => new Stand(x)));
     locationService.CalculateLocationDistances(standRepo.All());
 }