public void Loop0() { var returnValue = bookingmanagerLoop.FindAvailableRoom(DateTime.Today.AddDays(2), DateTime.Today.AddDays(3)); Assert.Equal(-1, returnValue); }
public void FindAvailableRoom_StartDateNotInTheFuture_ThrowsArgumentException() { BookingManager manager = CreateBookingManager(); DateTime date = DateTime.Today; Assert.Catch <ArgumentException>(() => manager.FindAvailableRoom(date, date)); }
// I have created a private test method here, because I expect in a future version to test // FindAvailableRoom() with several combinations of start and end dates. You would normally // use the TestCase attribute in such a situation, but TestCase attribute values must be // constant expressions. DateTime.Today.AddDays() is not a constant expression. private void FindAvailableRoom_RoomAvailable_RoomIdNotMinusOne(DateTime startDate, DateTime endDate) { BookingManager manager = CreateBookingManager(); int roomId = manager.FindAvailableRoom(startDate, endDate); Assert.AreNotEqual(-1, roomId); }
public void FindAvailableRoom_RoomNotAvailable_RoomIdIsMinusOne() { // Act var roomId = bookingManager.FindAvailableRoom(DateTime.Today.AddDays(8), DateTime.Today.AddDays(8)); // Assert Assert.Equal(-1, roomId); }
public void Test1() { // Act var roomId = bookingManager.FindAvailableRoom(DateTime.Today.AddDays(8), DateTime.Today.AddDays(9)); // Assert Assert.Equal(-1, roomId); }
//[Test] public void FindAvailableRoom_EndDateBeforeToday_ThrowsExceptionError() { BookingManager manager = CreateBookingManager(); DateTime today = DateTime.Today; var ex = Assert.Throws <ArgumentException>(() => manager.FindAvailableRoom(today, today.AddDays(-1))); StringAssert.Contains("Start and end date cannot be set to before current date, and end date should not be later than start date", ex.Message); }
public void FindAvailableRoom_RoomAvailable_RoomIdNotMinusOne() { BookingManager manager = CreateBookingManager(); DateTime date = DateTime.Today.AddDays(5); int roomId = manager.FindAvailableRoom(date, date); Assert.AreNotEqual(-1, roomId); }
public void FindAvailableRoom_InvalidInput_ThrowsExceptionError(int stNo, int edNo) { BookingManager manager = CreateBookingManager(); DateTime startdate = DateTime.Today.AddDays(stNo); DateTime enddate = DateTime.Today.AddDays(edNo); var ex = Assert.Throws <ArgumentException>(() => manager.FindAvailableRoom(startdate, enddate)); StringAssert.Contains("Start and end date cannot be set to before current date, and the start date later than the end date", ex.Message); }
public void FindAvailableRoom_AtLeastOneAvailableRoom_ReturnGreaterThanMinusOne() { BookingManager manager = CreateBookingManager(); DateTime start = DateTime.Today.AddDays(1); DateTime end = DateTime.Today.AddDays(2); int result = manager.FindAvailableRoom(start, end); int noRoomId = -1; Assert.IsTrue(result > noRoomId); }
public void FindAvailableRoom_NoAvailableRoom_ReturnMinusOne() { BookingManager manager = CreateBookingManager(); DateTime start = DateTime.Today.AddDays(10); DateTime end = DateTime.Today.AddDays(20); int result = manager.FindAvailableRoom(start, end); int noRoomId = -1; Assert.AreEqual(noRoomId, result); }
public void FindAvailableRoom_StartdateLargerThanEnddate_ThrowException() { BookingManager manager = CreateBookingManager(); DateTime start = DateTime.Today.AddDays(2); DateTime end = DateTime.Today.AddDays(1); var availableRoom = Assert.Throws <ArgumentException>(() => manager.FindAvailableRoom(start, end)); StringAssert.Contains("Start and end date cannot be set to before current date, and the start date later than the end date", availableRoom.Message); }
public void WhenILookForARoom() { try { _roomID = bm.FindAvailableRoom(DateTime.Today.AddDays(_startDate), DateTime.Today.AddDays(_endDate)); } catch (Exception e) { ScenarioContext.Current[("Error")] = e; //_exception = e; } }
public void ThenTheResultShouldBeActiveBookings() { Assert.Equal(1, bookingManager.FindAvailableRoom(booking.StartDate, booking.EndDate)); }
public void Edge1() { var returnValue = bookingmanager.FindAvailableRoom(DateTime.Today.AddDays(4), DateTime.Today.AddDays(5)); Assert.Equal(1, returnValue); }