public void Test2() { HotelLogic hotel = new HotelLogic(3, 15); bool result = true; var dates = new List <Tuple <int, int> >(6); dates.Add(new Tuple <int, int>(0, 5)); dates.Add(new Tuple <int, int>(7, 13)); dates.Add(new Tuple <int, int>(3, 9)); dates.Add(new Tuple <int, int>(5, 7)); dates.Add(new Tuple <int, int>(6, 6)); dates.Add(new Tuple <int, int>(0, 4)); for (int i = 0; i < dates.Count; i++) { result = hotel.addReservation(dates[i].Item1, dates[i].Item2); if (!result) { break; } } if (result) { Assert.Pass("All reservation accepted"); } else { Assert.Fail("Not all reservations accepted"); } }
public FormRoom(NumberofhotelLogic logicN, TypeofnumberLogic logicT, HotelLogic logicH) { _logicH = logicH; _logicN = logicN; _logicT = logicT; InitializeComponent(); }
public FormTravelReservation(TransportLogic logicT, RouteLogic logicR, HotelLogic logicH, NumberofhotelLogic logicN, ContractLogic logicC) { _logicT = logicT; _logicR = logicR; _logicH = logicH; _logicN = logicN; _logicC = logicC; InitializeComponent(); }
public void Test1b() { HotelLogic hotel = new HotelLogic(1, 365); var result = hotel.addReservation(200, 400); if (!result) { Assert.Pass("Reservation declined"); } else { Assert.Fail("Reservation accepted"); } }
public IActionResult Reset() { hotelLogic = new HotelLogic(); Both both = new Both(2, 15); hotel.Bookings = hotelLogic.bookings; hotel.Size = hotelLogic.size; hotel.Days = hotelLogic.days; both.Reservation = new Reservation(); both.Hotel = hotel; return(View("~/Views/Home/Index.cshtml", both)); }
public void AddingHotel() { var UoW = new Mock <UnitOfWork>(); UoW.Object.DeleteDB(); var HotelLogic = new HotelLogic(UoW.Object); var UserLogic = new UserLogic(UoW.Object); UserLogic.AddUser(new Logic.DTOs.UserDTO("Sasha", Logic.DTOs.UserType.Manager, "Veklych", "Login", "Password")); UserLogic.Login("Login", "Password"); HotelLogic.AddHotel(new Logic.DTOs.HotelDTO("Verkhovina", 3, "Khust, Zhayvoronkova 44/2")); Assert.That(HotelLogic.GetAllHotels().Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Name == "Verkhovina"); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Stars == 3); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Address == "Khust, Zhayvoronkova 44/2"); }
public void AddingHotel() { var UoW = new Mock <UnitOfWork>(); UoW.Object.DeleteDB(); var HotelLogic = new HotelLogic(UoW.Object); var UserLogic = new UserLogic(UoW.Object); UserLogic.AddUser(new Logic.DTOs.UserDTO("Dimon", Logic.DTOs.UserType.Manager, "Cherneckii", "Login", "Password")); UserLogic.Login("Login", "Password"); HotelLogic.AddHotel(new Logic.DTOs.HotelDTO("auiwhe", 3, "auiwhe--, petuch 44/2")); Assert.That(HotelLogic.GetAllHotels().Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Name == "auiwhe"); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Stars == 3); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Address == "auiwhe--, petuch 44/2"); }
public void Test5() { HotelLogic hotel = new HotelLogic(2, 16); List <bool> results = new List <bool>(); var dates = new List <Tuple <int, int> >(6); dates.Add(new Tuple <int, int>(1, 3)); dates.Add(new Tuple <int, int>(0, 4)); dates.Add(new Tuple <int, int>(2, 3)); dates.Add(new Tuple <int, int>(5, 5)); dates.Add(new Tuple <int, int>(4, 10)); dates.Add(new Tuple <int, int>(10, 10)); dates.Add(new Tuple <int, int>(6, 7)); dates.Add(new Tuple <int, int>(8, 10)); dates.Add(new Tuple <int, int>(8, 9)); for (int i = 0; i < dates.Count; i++) { results.Add(hotel.addReservation(dates[i].Item1, dates[i].Item2)); } List <bool> expected = new List <bool>(); expected.Add(true); expected.Add(true); expected.Add(false); expected.Add(true); expected.Add(false); expected.Add(true); expected.Add(true); expected.Add(true); expected.Add(true); if (results.SequenceEqual(expected)) { Assert.Pass("Not all reservations accepted"); } else { Assert.Fail("All reservation accepted"); } }
public void AddingHotelRoomToHotel() { var UoW = new Mock <UnitOfWork>(); UoW.Object.DeleteDB(); var HotelLogic = new HotelLogic(UoW.Object); var UserLogic = new UserLogic(UoW.Object); UserLogic.AddUser(new Logic.DTOs.UserDTO("Sasha", Logic.DTOs.UserType.Manager, "Veklych", "Login", "Password")); UserLogic.Login("Login", "Password"); HotelLogic.AddHotel(new Logic.DTOs.HotelDTO("Verkhovina", 3, "Khust, Zhayvoronkova 44/2")); HotelLogic.AddHotelRoom(HotelLogic.GetAllHotels().ToList()[0].Id, new Logic.DTOs.HotelRoomDTO(1, 3, 250)); Assert.That(UoW.Object.HotelsRooms.GetAll().Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms.Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms[0].Hotel.Id == HotelLogic.GetAllHotels().ToList()[0].Id); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms[0].Number == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms[0].SleepingPlaces == 3); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms[0].Price == 250); }
public void AddingHotelRoomToHotel() { var UoW = new Mock <UnitOfWork>(); UoW.Object.DeleteDB(); var HotelLogic = new HotelLogic(UoW.Object); var UserLogic = new UserLogic(UoW.Object); UserLogic.AddUser(new Logic.DTOs.UserDTO("Dimon", Logic.DTOs.UserType.Manager, "Cherneckii", "Login", "Password")); UserLogic.Login("Login", "Password"); HotelLogic.AddHotel(new Logic.DTOs.HotelDTO("auiwhe", 3, "auiwhe--, petuch 44/2")); HotelLogic.AddHotelRoom(HotelLogic.GetAllHotels().ToList()[0].Id, new Logic.DTOs.HotelRoomDTO(1, 3, 250)); Assert.That(UoW.Object.HotelsRooms.GetAll().Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms.Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms[0].Hotel.Id == HotelLogic.GetAllHotels().ToList()[0].Id); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms[0].Number == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms[0].SleepingPlaces == 3); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms[0].Price == 250); }
public HotelController() { this.hotelBLL = new HotelLogic(); }
public void ReservingRoom() { var UoW = new Mock <UnitOfWork>(); UoW.Object.DeleteDB(); var UserLogic = new UserLogic(UoW.Object); var HotelLogic = new HotelLogic(UoW.Object); UserLogic.AddUser(new Logic.DTOs.UserDTO("Sasha", Logic.DTOs.UserType.Manager, "Veklych", "Login", "Password")); UserLogic.Login("Login", "Password"); HotelLogic.AddHotel(new Logic.DTOs.HotelDTO("Verkhovina", 3, "Khust, Zhayvoronkova 44/2")); HotelLogic.AddHotelRoom(HotelLogic.GetAllHotels().ToList()[0].Id, new Logic.DTOs.HotelRoomDTO(1, 3, 250)); Assert.That(UoW.Object.HotelsRooms.GetAll().Count() == 1); Assert.That(HotelLogic.GetAllHotels().ToList()[0].Rooms.Count() == 1); UserLogic.ReserveRoom(1, 1, 1, DateTimeOffset.Parse("21.12.2018"), DateTimeOffset.Parse("25.12.2018")); var User = UserLogic.GetAllUsers().First(u => u.Id == 1); Assert.That(User.HotelRoomReservations.Count == 1); Assert.That(User.HotelRoomReservations[0].HotelAddress == "Khust, Zhayvoronkova 44/2"); Assert.That(User.HotelRoomReservations[0].HotelName == "Verkhovina"); Assert.That(User.HotelRoomReservations[0].HotelRoomNumber == 1); Assert.That(User.HotelRoomReservations[0].HotelRoomPrice == 250); Assert.That(User.HotelRoomReservations[0].HotelRoomSleepingPlaces == 3); Assert.That(User.HotelRoomReservations[0].HotelStars == 3); Assert.That(User.HotelRoomReservations[0].ClientName == "Sasha"); Assert.That(User.HotelRoomReservations[0].ClientSurname == "Veklych"); Assert.That(User.HotelRoomReservations[0].ArrivalDate.CompareTo(DateTimeOffset.Parse("21.12.2018")) == 0); Assert.That(User.HotelRoomReservations[0].DepartureDate.CompareTo(DateTimeOffset.Parse("25.12.2018")) == 0); Assert.That(HotelLogic.GetAllHotels().First(h => h.Id == 1).Rooms.First(r => r.Id == 1).BookedDays.Contains(DateTimeOffset.Parse("21.12.2018"))); Assert.That(HotelLogic.GetAllHotels().First(h => h.Id == 1).Rooms.First(r => r.Id == 1).BookedDays.Contains(DateTimeOffset.Parse("22.12.2018"))); Assert.That(HotelLogic.GetAllHotels().First(h => h.Id == 1).Rooms.First(r => r.Id == 1).BookedDays.Contains(DateTimeOffset.Parse("23.12.2018"))); Assert.That(HotelLogic.GetAllHotels().First(h => h.Id == 1).Rooms.First(r => r.Id == 1).BookedDays.Contains(DateTimeOffset.Parse("24.12.2018"))); Assert.That(!HotelLogic.GetAllHotels().First(h => h.Id == 1).Rooms.First(r => r.Id == 1).BookedDays.Contains(DateTimeOffset.Parse("25.12.2018"))); Assert.Throws <AlreadyBookedItemException>(delegate { UserLogic.ReserveRoom(1, 1, 1, DateTimeOffset.Parse("23.12.2018"), DateTimeOffset.Parse("24.12.2018")); }); UserLogic.ReserveRoom(1, 1, 1, DateTimeOffset.Parse("25.12.2018"), DateTimeOffset.Parse("28.12.2018")); User = UserLogic.GetAllUsers().First(u => u.Id == 1); Assert.That(User.HotelRoomReservations.Count == 2); Assert.That(User.HotelRoomReservations[1].HotelAddress == "Khust, Zhayvoronkova 44/2"); Assert.That(User.HotelRoomReservations[1].HotelName == "Verkhovina"); Assert.That(User.HotelRoomReservations[1].HotelRoomNumber == 1); Assert.That(User.HotelRoomReservations[1].HotelRoomPrice == 250); Assert.That(User.HotelRoomReservations[1].HotelRoomSleepingPlaces == 3); Assert.That(User.HotelRoomReservations[1].HotelStars == 3); Assert.That(User.HotelRoomReservations[1].ClientName == "Sasha"); Assert.That(User.HotelRoomReservations[1].ClientSurname == "Veklych"); Assert.That(User.HotelRoomReservations[1].ArrivalDate.CompareTo(DateTimeOffset.Parse("25.12.2018")) == 0); Assert.That(User.HotelRoomReservations[1].DepartureDate.CompareTo(DateTimeOffset.Parse("28.12.2018")) == 0); Assert.That(HotelLogic.GetAllHotels().First(h => h.Id == 1).Rooms.First(r => r.Id == 1).BookedDays.Contains(DateTimeOffset.Parse("27.12.2018"))); Assert.That(HotelLogic.GetAllHotels().First(h => h.Id == 1).Rooms.First(r => r.Id == 1).BookedDays.Contains(DateTimeOffset.Parse("26.12.2018"))); Assert.That(HotelLogic.GetAllHotels().First(h => h.Id == 1).Rooms.First(r => r.Id == 1).BookedDays.Contains(DateTimeOffset.Parse("25.12.2018"))); Assert.Throws <AlreadyBookedItemException>(delegate { UserLogic.ReserveRoom(1, 1, 1, DateTimeOffset.Parse("19.12.2018"), DateTimeOffset.Parse("30.12.2018")); }); }
public FormHotel(HotelLogic logicH) { _logicH = logicH; InitializeComponent(); }
public HotelController(HotelLogic hotelLogic) { this.hotelLogic = hotelLogic; }