public AccountDB(GuestController controller) : base() { guestController = controller; accounts = new Collection <Account>(); ReadDataFromTable(sql_SELECT1, table1); }
public ReservationGuestNames() { InitializeComponent(); guestController = new GuestController(); HelperStaticClass.guests = new List <Guest>(); HelperStaticClass.guestsDictionery = new Dictionary <Guest, int>(); }
public static void GenerateGuestMenu() { while (true) { GuestController guestController = new GuestController(); Console.Clear(); Console.WriteLine("--- Ngân hàng Spring Hero Bank ---"); Console.WriteLine("1. Đăng ký tài khoản."); Console.WriteLine("2. Đăng nhập hệ thống."); Console.WriteLine("3. Thoát."); Console.WriteLine("----------------------------------"); Console.WriteLine("Nhập lựa chọn của bạn (1,2,3): "); var choice = int.Parse(Console.ReadLine()); switch (choice) { case 1: if (guestController.Register()) { Console.WriteLine("Đăng ký tài khoản thành công!"); } else { Console.WriteLine("Đăng ký tài khoản thất bại vui lòng thử lại!"); } break; case 2: var account = guestController.Login(); if (account == null) { Console.WriteLine("Đăng nhập thất bại!"); break; } Program.currentLogin = account; if ((int)Program.currentLogin.Role == 1) { UserMenu.GenerateGuestMenu(); } else { AdminMenu.GenerateAdminMenu(); } break; case 3: Console.WriteLine("Cảm ơn quý khách đã sử dụng dịch vụ của chúng tôi!"); break; default: Console.WriteLine("Vui lòng nhập lựa chọn từ 1-3."); break; } Console.ReadLine(); if (choice == 3) { break; } } }
public GuestControllerShould() { _guestQueryMock = new Mock <IGuestQuery>(); _guestMock = new Mock <Guest>(); _sut = new GuestController(_guestQueryMock.Object); }
static void Main(string[] args) { #region FacadePattern //DbClient dbClient = new DbClient(); //dbClient.SelectAllHotels(); //Console.WriteLine(); //dbClient.SelectSpecificHotel(7); //Console.WriteLine(); //dbClient.Insert(9, "Fiskefars Bodel Hotel", "Fisketorvet 69, 4000 Roskilde"); //dbClient.SelectAllHotels(); //Console.WriteLine(); //dbClient.Delete(9); //dbClient.SelectAllHotels(); //dbClient.UpdateHotel(1, "The Pepe", "Pepestreet 420"); //dbClient.SelectAllHotels(); #endregion GuestController gController = new GuestController(); //gController.CreateGuest(new Guest() { GuestNr = 31, Navn = "Gunner Jensen", Adresse = "Gedevej 29, 4000 Roskilde" }); gController.DeleteGuest(31); Console.ReadLine(); }
public GuestForm(GuestController aController, PaymentController aPController, FormState aState) : base() { InitializeComponent(); guestController = aController; paymentController = aPController; myState = aState; }
public GuestListingForm(GuestController aController, AccountDB acctDB) { InitializeComponent(); guestController = aController; this.Load += GuestListingForm_Load; this.FormClosed += GuestListingForm_FormClosed; this.Activated += GuestListingForm_Activated; accountDB = acctDB; }
public GuestMDIParent() { InitializeComponent(); guestController = new GuestController(); accountDB = new AccountDB(guestController); bookingController = new BookingController(guestController); accountDB.setBookingController(bookingController); this.WindowState = FormWindowState.Maximized; }
public CheckAvailability(BookingController aBController, RoomController aRController, RoomRateController aRRController, GuestController aGConntroller, PaymentController aPController) { InitializeComponent(); bookingController = aBController; roomController = aRController; roomRateController = aRRController; guestController = aGConntroller; paymentController = aPController; }
public GuestForm(GuestController aController, PaymentController aPController, FormState aState, Booking b, BookingController bookingController) : base() { InitializeComponent(); guestController = aController; paymentController = aPController; this.bookingController = bookingController; myState = aState; aBooking = b; }
public Home() { InitializeComponent(); guestController = new GuestController(); bookingController = new BookingController(); roomController = new RoomController(); roomRateController = new RoomRateController(); paymentController = new PaymentController(); }
public void IndexTest() { var mockS = new Mock <IGuestService>(); GuestController guestController = new GuestController(mockS.Object); var result = guestController.Index().Result as ViewResult; Assert.IsTrue(result.ViewData.ContainsKey("Succes")); }
public MainWindowViewModel(IWindowController windowController, PartyGuest guest) : base(windowController) { if (guest != null) { GuestController guestController = new GuestController(); GuestViewModel viewModel = new GuestViewModel(guestController, partyGuest: guest); guestController.ShowWindow(viewModel); } }
public ReservationDetailsDisplayForm(BookingController abookingController, RoomController aroomController, GuestController aGController, Booking b, PaymentController aPController) { InitializeComponent(); bookingController = abookingController; roomController = aroomController; guestController = aGController; paymentController = aPController; obj = b; }
public void TestRoomList() { var sut = new GuestController(); var view = sut.ChooseRegion(); //When //Then Assert.NotNull(view); Assert.IsType <ViewResult>(view); }
public AccountForm(AccountDB accountDB, GuestController aController) { InitializeComponent(); this.Text = "Accounts"; this.Load += AccountForm_Load; this.Activated += AccountForm_Activated; this.FormClosed += AccountForm_FormClosed; this.accountDB = accountDB; accounts = accountDB.AllAccounts; currentAccount = accounts[0]; guestController = aController; }
public EnquiryForm(RestEasyMDIParent re) { resController = new ReservationController(); guestController = new GuestController(); accountController = new AccountController(); reservations = resController.AllReservations; guests = guestController.AllGuests; guestAccounts = accountController.AllAccounts; InitializeComponent(); hideAllPanels(); restEasy = re; }
public GuestForm(ReservationController res, RestEasyMDIParent re) { InitializeComponent(); panelVerification.Show(); panelGuestDetails.Hide(); btnSearchAgain.Hide(); guestController = new GuestController(); // pass in instance Guests = guestController.AllGuests; reservationController = res; restEasy = re; this.MdiParent = restEasy; }
public OccupancyReport(GuestController guestController, BookingController controller, AccountDB acctDB) { InitializeComponent(); this.Text = "Occupancy Report"; this.guestController = guestController; guests = guestController.AllGuests; bookingController = controller; bookings = bookingController.AllBookings; accountDB = acctDB; accounts = acctDB.AllAccounts; this.Load += ReportForm_Load; this.Activated += ReportForm_Activated; this.FormClosed += ReportForm_FormClosed; }
public void Delete_NotNull_ResultIsNotNull() { //Arrange var guest = new GuestViewModel(); var mock = new Mock <IGuestService>(); mock.Setup(g => g.DeleteGuests(guest.Id)); var controller = new GuestController(mock.Object); //Act ViewResult result = controller.Delete(guest.Id) as ViewResult; //Assert Assert.IsNotNull(result); }
public void Create__NotNull_ViewResultIsNotNull() { //Arrange var guest = new GuestViewModel(); var mock = new Mock <IGuestService>(); mock.Setup(g => g.AddGuest(guest)); var controller = new GuestController(mock.Object); //Act ViewResult result = controller.Create() as ViewResult; Assert.IsNotNull(result); }
public void CreateTest() { var mockS = new Mock <IGuestService>(); GuestViewModel guest = new GuestViewModel { LastName = "Hasan", FirstName = "Test", Address = "test", PostCode = "44", Country = "nl", Town = "grt", PhoneNumber = "123", Email = "nnn" }; mockS.Setup(p => p.AddGuest(guest)).Returns(7); GuestController guestController = new GuestController(mockS.Object); var result = guestController.Create(guest).Result as ViewResult; Assert.IsTrue(result.ViewData.Values.Contains("The guest Hasan has registered succesfully!")); }
public void Details_GuestDoesNotExist_ReturnsNotFoundResults() { // Arrange var guestsRepo = new Mock <IGuestService>(); guestsRepo.Setup(g => g.ReadSingle(It.IsAny <int>())).Throws(It.IsAny <Exception>()); var controller = new GuestController(guestsRepo.Object); // Act var result = controller.Details(123); // Assert Assert.That(result, Is.TypeOf <BadRequestResult>()); }
public GuestForm(GuestController aController, AccountDB accDB) { InitializeComponent(); guestController = aController; accountDB = accDB; this.Load += GuestForm_Load; this.FormClosed += GuestForm_FormClosed; this.Activated += GuestForm_Activated; if (myState == FormState.Add) { int size = aController.AllGuests.Count() + 1; idTextBox.Text = size + ""; } }
public void Index_IsNotNull_ViewResultIsNotNull() { // arrange int pageNumber = 1; string searchString = ""; var filter = new GuestFilter(); var mock = new Mock <IGuestService>(); GuestController controller = new GuestController(mock.Object); // act var result = controller.Index(searchString, pageNumber, filter); //assert var res = result as ViewResult; Assert.IsNotNull(res); }
public void TestRoomRemoval() { var sut = new GuestController(); GuestController.Current = new Reservation(); GuestController.Current.Rooms = new List <Room>(); GuestController.Current.Rooms.Add(new Room { RoomID = 2, IsOccupied = false, MaxCapacity = 4, NumberOfBathrooms = 2, NumberOfBeds = 4, DailyRate = 100M, LocationID = 1, SizeSqFt = 450 }); sut.RemoveRoom(); var actual = GuestController.Current.Rooms; var expected = 0; Assert.True(actual.Count == expected); }
public void Index_ReturnsModelAndModelNotNull() { //Arrange var serCreatMoq = new Mock<IServiceCreator>(); var commentServMoq = new Mock<ICommentsSerice>(); serCreatMoq.Setup(m => m.CreateCommentService()).Returns(commentServMoq.Object); commentServMoq.Setup(m => m.GetComments()).Returns(GetComments()); var controller = new GuestController(serCreatMoq.Object); //Act var result = controller.Index() as ViewResult; //Assert Assert.IsNotNull(result.Model); }
public void DetailsTest() { var mockS = new Mock <IGuestService>(); GuestViewModel guest = new GuestViewModel() { LastName = "Hasan" }; mockS.Setup(p => p.GetGuest(1)).ReturnsAsync(guest); GuestController guestController = new GuestController(mockS.Object); var result = guestController.Details(1).Result as ViewResult; Assert.AreEqual("Hasan", (result.Model as GuestViewModel).LastName); }
public void IndexPost_ReturnsModelAndModelNotNull() { //Arrange var serCreatMoq = new Mock<IServiceCreator>(); var commentServMoq = new Mock<ICommentsSerice>(); serCreatMoq.Setup(m => m.CreateCommentService()).Returns(commentServMoq.Object); commentServMoq.Setup(m => m.GetComments()).Returns(GetComments()); var controller = new GuestController(serCreatMoq.Object); var newComment = new CommentsViewModel { NewCommentAuthor = "author1", NewCommentText = "test1" }; //Act var result = controller.Index(newComment) as PartialViewResult; //Assert Assert.IsNotNull(result.Model); }
public void Create_Success_ReturnsARedirectToActionResut() { // Arrange var testGuest = new GuestViewModel(); var guestsRepo = new Mock <IGuestService>(); guestsRepo.Setup(g => g.AddGuest(It.IsAny <GuestViewModel>())); var controller = new GuestController(guestsRepo.Object); // Act var result = controller.Create(testGuest); // Assert var redirectToActionResult = result as RedirectToActionResult; Assert.AreEqual("Index", redirectToActionResult.ActionName); }