public bool Accept(IReservation[] reservations, IReservation candidate, ITable[] tables, TimeSpan seatingDuration) { var sameDayReservations = new SameDayReservationFilter() .Filter(reservations, candidate, seatingDuration); int total = sameDayReservations .Sum(r => r.Quantity); return(candidate .CanFit(new RectangularTable(tables.Sum(t => t.Size) - total))); }
public bool Accept( IReservation[] reservations, IReservation candidate, ITable[] tables, TimeSpan seatingDuration) { var sameDayReservations = new SameDayReservationFilter() .Filter(reservations, candidate, seatingDuration); var assignedTables = new BestFitTableAssigner() .Assign(sameDayReservations, tables); var leftTables = tables.Except(assignedTables); return(leftTables.Any(t => candidate.CanFit(t))); }