public override void Tick()
        {
            var openCount = ParkingLocations.Count(r => !r.IsFull);

            if (openCount > 0)
            {
                while (InQueue.Count > 0)
                {
                    var location = FindOpenLocation();
                    if (location != null)
                    {
                        location.ParkAuto(InQueue.Dequeue());
                    }
                    else
                    {
                        break;
                    }
                }
            }

            var departing = ParkingLocations.Where(r => r.Occupant != null && r.Occupant.DateToDepart <= Simulator.Clock.Now);

            foreach (var item in departing)
            {
                AutoExitingFrom(item);
            }
            base.Tick();
            while (OutQueue.Count > 0)
            {
                Parent.OutQueue.Enqueue(OutQueue.Dequeue());
            }
        }
        public void DeleteParkingLocation(string globalid)
        {
            ParkingLocations location = new ParkingLocations()
            {
                GlobalId = new Guid(globalid)
            };

            _context.ParkingLocations.Attach(location);
            _context.Remove <ParkingLocations>(location);
            _context.SaveChanges();
        }
        public void GetLocation_WithValidID_ReturnsLocation()
        {
            //Arrange
            ParkingLocations result = null;

            //Act
            result = _dataAccessManager.GetParkingLocationById("736b13df-e666-4ef8-bd22-dc2500634020");

            //Assert
            Assert.IsNotNull(result);
        }
        public ParkingLocation FindOpenLocation()
        {
            var open  = ParkingLocations.Where(r => r.Occupant == null);
            var count = open.Count();

            if (count > 0)
            {
                var location = Simulator.Random.Next(count - 1);
                return(open.ToList()[location]);
            }
            else
            {
                return(null);
            }
        }
        public void InsertParkingLocation(ParkingLocations location)
        {
            _context.ParkingLocations.Add(location);

            _context.SaveChanges();
        }