public void ReserveRoomReturnsFalse() { //arrange _findFreeRoom.ReturnNumberOfFreeRoom(Arg.Any <int[][]>(), Arg.Any <int>(), Arg.Any <int>()).Returns(-1); //act var roomReservationResult = _roomReservation.ReserveRoom((1, 2)); //assert Assert.False(roomReservationResult); _findFreeRoom.Received(1).ReturnNumberOfFreeRoom(Arg.Any <int[][]>(), Arg.Any <int>(), Arg.Any <int>()); }
public bool ReserveRoom(ValueTuple <int, int> reservationDays) { int numberOfFreeRoom = _findFreeRoom.ReturnNumberOfFreeRoom(_hotel.Rooms, reservationDays.Item1, reservationDays.Item2); if (numberOfFreeRoom == -1) { return(false); } else { for (int i = reservationDays.Item1; i <= reservationDays.Item2; i++) { _hotel.Rooms[numberOfFreeRoom][i] = 1; } return(true); } }