public void Setup() { hotelRepository = new Mock <IHotelRepository>(); costumerRepository = new Mock <ICustomerRepository>(); bookHotel = new BookHotel(hotelRepository.Object, costumerRepository.Object); }
public void BookHotel(BookHotel bookHotel) { using (UserContext userContext = new UserContext()) { //Booking the hotel userContext.BookHotels.Add(bookHotel); userContext.SaveChanges(); } }
public ActionResult BookingHotel(HotelTimingViewModel bookHotelViewModel) { BookHotel bookHotel = AutoMapper.Mapper.Map <BookViewModel, BookHotel>(bookHotelViewModel.BookViewModel); hotelDetails.UpdateRoomCount(bookHotelViewModel.BookViewModel.HotelRoomId); bookHotel.CheckIn = bookHotelViewModel.TimingViewModel.CheckIn; bookHotel.CheckOut = bookHotelViewModel.TimingViewModel.CheckOut; bookHotel.Gmail = bookHotelViewModel.BookViewModel.UserId; hotelDetails.BookHotel(bookHotel); Referral referral = hotelDetails.GetReferrerDetail(bookHotel.Gmail); if (referral != null) { hotelDetails.Reward(referral.ReferrerId); } TempData["alertMessage"] = "Booked Successfully"; return(RedirectToAction("ManageHotel", "Hotel", new { Approved = "Approved" })); }
public void HotelBooking() { try { test = extent.CreateTest("HotelBooking"); LoginPage loginPage = new LoginPage(webDriver); MainPage mainPage = new MainPage(webDriver); BookHotel bookHotel = new BookHotel(webDriver); loginPage.UserLogin(baseURL, webDriver, userName, passKey); //mainPage.TabPlan.Click(); same isn't working sometimes on IE, so this is workaround; WDEx.JSExeClick(webDriver, mainPage.TabPlan); //mainPage.TabPlanClick(webDriver); //new Actions(webDriver).DoubleClick(columns[2].FindElement(By.TagName("span"))).Perform(); mainPage.Departure.Click(); Thread.Sleep(WDEx.delaySml); test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "Departures")); mainPage.SwitchToIFrame(webDriver, "contentIFrame0"); mainPage.OpenBookHotel(3); WDEx.SwitchWindows(webDriver, 1); DataInput.initializeHotel(); bookHotel.PropertyBook(DataInput.hotelDictionary, Browser); bookHotel.NumBookRoom(DataInput.roomNumDictionary.Values.Sum()); bookHotel.RoomDetails(webDriver, DataInput.roomNumDictionary, DataInput.adultCountDictionary, DataInput.childCountDictionary, DataInput.childAge); test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "HotelDetails")); //Simple click isn't working in IE, that's why JSExecutor is used to Click; //bookHotel.Search.Click(); WDEx.JSExeClick(webDriver, bookHotel.Search); bookHotel.SelectRoomOptions(webDriver, DataInput.roomNumDictionary, DataInput.adultCountDictionary, DataInput.childCountDictionary); test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "RoomAllocation")); //Simple click isn't working in IE, that's why JSExecutor is used to Click; //bookHotel.ContinueToPayment.Click(); WDEx.JSExeClick(webDriver, bookHotel.ContinueToPayment); bookHotel.GuestInformation(webDriver, DataInput.roomNumDictionary, DataInput.adultCountDictionary, DataInput.childCountDictionary); test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "GuestInformation")); //Simple click isn't working in IE, that's why JSExecutor is used to Click; //bookHotel.Continue.Click(); WDEx.JSExeClick(webDriver, bookHotel.Continue); bookHotel.FillCardInfo(webDriver, DataInput.roomNumDictionary, DataInput.cardInfo); test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "FillCardInfo")); //Simple click isn't working in IE, that's why JSExecutor is used to Click; //bookHotel.SubmitOrder.Click(); WDEx.JSExeClick(webDriver, bookHotel.SubmitOrder); bookHotel.FillBookInfo(webDriver, DataInput.bookInfo); test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "BookInfo")); //Simple click isn't working in IE, that's why JSExecutor is used to Click; //bookHotel.Reserve.Click(); WDEx.JSExeClick(webDriver, bookHotel.Reserve); test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "Reserve")); //Simple click isn't working in IE, that's why JSExecutor is used to Click; //bookHotel.Done.Click(); WDEx.JSExeClick(webDriver, bookHotel.Done); Thread.Sleep(WDEx.delayAvg); mainPage.UserSignOut(webDriver); test.Log(Status.Pass, "Screenshot Below:" + test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "Failing Scenario"))); } catch (Exception e) { test.Log(Status.Fail, "Screenshot Below:" + test.AddScreenCaptureFromPath(WDEx.Capture(webDriver, "Failing Scenario"))); Console.WriteLine(e.Message); } }
public void BookHotel(BookHotel bookHotel) { hotelRepository.BookHotel(bookHotel); }