public void TestCreateBookingReadyToGo() { //Arrange ReadyToGoController readyToGoController = new ReadyToGoController(); BookingController bookingController = new BookingController(); CalendarController calendarController = new CalendarController(); DateTime startDate = new DateTime(2017, 12, 24, 11, 00, 00); DateTime endDate = new DateTime(2017, 12, 24, 11, 30, 00); Calendar calendar = calendarController.Get(2); int i = 0; bool found = true; //Act //No function for getting calendar id right now so it is set as 2 ReadyToGo testReadyToGo = new ReadyToGo(startDate, endDate, "ReadyToGo", 99, 2, "Test1234", 1, true); testReadyToGo.AdditionalServices = "Test"; ReadyToGo readyToGo = null; try { readyToGoController.Create(testReadyToGo); } catch { Console.WriteLine("Booking Exists"); } List <Booking> allReadyToGo = bookingController.GetAllBookingSpecificDay(testReadyToGo.Calendar_Id, testReadyToGo.StartDate.Date).ToList(); //Assert while (found || allReadyToGo.Count <= i) { if (allReadyToGo[i].StartDate == testReadyToGo.StartDate && allReadyToGo[i].EndDate == testReadyToGo.EndDate) { readyToGo = readyToGoController.GetReadyToGo(allReadyToGo[i].Id); found = false; } else { i++; } } Assert.AreEqual(readyToGo.StartDate, testReadyToGo.StartDate); Assert.AreEqual(readyToGo.EndDate, testReadyToGo.EndDate); Assert.AreEqual(readyToGo.BookingType, testReadyToGo.BookingType); Assert.AreEqual(readyToGo.User_Id, testReadyToGo.User_Id); Assert.AreEqual(readyToGo.Calendar_Id, testReadyToGo.Calendar_Id); Assert.AreEqual(readyToGo.ProductNr, testReadyToGo.ProductNr); Assert.AreEqual(readyToGo.AppendixNr, testReadyToGo.AppendixNr); Assert.AreEqual(readyToGo.Contract, testReadyToGo.Contract); }