public void TestImpossibleReservationsDueToLackOfTimeSlots() { for (int i = 0; i < this.lanes.Count; i++) { var reservation = new Reservation() { CreatedAt = DateTime.Now, Name = "Gert", NumberOfPlayers = 4, PhoneNumber = 1234, PlayAt = DateTime.Now }; reservation.AddLane(this.lanes[i]); reservation.AddTimeSlot((from y in this.timeSlots select y).First<TimeSlot>()); this._session.Save(reservation); } // since we filled out all lanes at that timeslot, the next booking for that timeslot should not be possible var service = new ReservationPossibleService(); var request = new ReservationPossible() { Reservation = new ReservationType() { HowManyHours = 2, NumberOfPlayers = 8, PlayAt = DateTime.Now, TimeOfDay = (from y in this.timeSlots select y).First<TimeSlot>().Start } }; ReservationPossibleResponse response = service.OnPost(request) as ReservationPossibleResponse; Assert.That(response.IsPossible, Is.False); Assert.That(response.Suggestions.Count, Is.EqualTo(2)); }
public void TestValidReservationWithNoOtherReservations() { var service = new ReservationPossibleService(); var request = new ReservationPossible() { Reservation = new ReservationType() { HowManyHours = 2, NumberOfPlayers = 4, PlayAt = DateTime.Now, TimeOfDay = TimeSpan.FromHours(10) } }; ReservationPossibleResponse response = service.OnPost(request) as ReservationPossibleResponse; Assert.That(response.IsPossible, Is.True); }
public void TestValidResrvationWithSomeOtherReservations() { var reservation = new Reservation() { CreatedAt = DateTime.Now, Name = "Gert", NumberOfPlayers = 4, PhoneNumber = 1234, PlayAt =DateTime.Now }; reservation.AddLane((from y in this.lanes select y).First<Lane>()); reservation.AddTimeSlot((from y in this.timeSlots select y).First<TimeSlot>()); this._session.Save(reservation); var service = new ReservationPossibleService(); var request = new ReservationPossible() { Reservation = new ReservationType() { HowManyHours = 2, NumberOfPlayers = 8, PlayAt = DateTime.Now, TimeOfDay = (from y in this.timeSlots select y).First<TimeSlot>().Start } }; ReservationPossibleResponse response = service.OnPost(request) as ReservationPossibleResponse; Assert.That(response.IsPossible, Is.True); }