public void Should_Manager_Can_Tell_Boy_To_Fetch(string plateNumber, string parkingTicket) { //Given var manager = new ParkingManager("Chris"); var employee = new ParkingBoy("Jack"); var employee2 = new SmartParkingBoy("Joy"); manager.HireBoy(employee); manager.HireBoy(employee2); string parkMessage = string.Empty; string fectchMessage = string.Empty; var fetchedCar = new Car(plateNumber); var ticket = parkingTicket; var parkingLots = new List <CarLot <string, Car> >() { new CarLot <string, Car>(), }; manager.ManagerPark(fetchedCar, parkingLots, out parkMessage); Car expected = fetchedCar; //When var result = manager.ManagerFetch(ticket, parkingLots, out fectchMessage); //Then Assert.IsType <Car>(result); Assert.Equal(expected, result); }
public RegisterViewModel(string userRole, ParkingManager pkm, Action navigateToLogin) { _userRole = userRole; _pkManager = pkm; RegisterUserCommand = new RegisterCommand(Register); NavigateToLogin = new RegisterCommand(navigateToLogin); }
public void Should_Manager_Can_Tell_Boy_To_Park(string plateNumber, string parkingTicket) { //Given var manager = new ParkingManager("Chris"); var employee = new ParkingBoy("Jack"); var employee2 = new SmartParkingBoy("Joy"); manager.HireBoy(employee); manager.HireBoy(employee2); string parkMessage = string.Empty; var car = new Car(plateNumber); var parkingLots = new List <CarLot <string, Car> >() { LotInitialize.FillLotWithCars(10, 20), LotInitialize.FillLotWithCars(8, 30), }; string expected = parkingTicket; //When var result = manager.ManagerPark(car, parkingLots, out parkMessage); //Then Assert.IsType <string>(result); Assert.Equal(expected, result); }
public void should_report_when_manager_manages_one_parking_lot_and_different_parking_boys() { var parkingLot = new ParkingLotBuilder() .WithCapacity(100) .WithOccupiedParkingSpace(10) .Create(); var parkingBoy = new ParkingBoy(new ParkingLotBuilder().WithCapacity(200).WithOccupiedParkingSpace(20).Create()); var smartParkingBoy = new SmartParkingBoy(new ParkingLotBuilder().WithCapacity(300).WithOccupiedParkingSpace(30).Create()); var superParkingBoy = new SuperParkingBoy( new ParkingLotBuilder().WithCapacity(400).WithOccupiedParkingSpace(40).Create()); var parkingManager = new ParkingManager(parkingBoy, smartParkingBoy, superParkingBoy, parkingLot); var parkingDirector = new ParkingDirector(parkingManager); var actualReportText = parkingDirector.ParkingReport.ToString("markdown"); actualReportText.Should().StartWith( "# M 100 1000" + NewLine + "* P 10 100"); actualReportText.Should().Contain("## B 20 200" + NewLine + "* P 20 200"); actualReportText.Should().Contain("## B 30 300" + NewLine + "* P 30 300"); actualReportText.Should().Contain("## B 40 400" + NewLine + "* P 40 400"); }
void should_can_pick_the_car_when_manage_parking_lots_and_parking_boys_and_park_a_car() { var lotNoSpace = new ParkingLot(0); var lotHasSpace = new ParkingLot(2); var boy = new SuperParkingBoy(lotHasSpace); var superBoy = new SuperParkingBoy(lotHasSpace); var smartBoy = new SuperParkingBoy(lotNoSpace); var manager = new ParkingManager(lotNoSpace, boy, smartBoy, superBoy); var car = new Car(); var token = manager.Park(car); Assert.Same(car, manager.Pick(token)); token = manager.Park(car); Assert.Same(car, boy.Pick(token)); token = manager.Park(car); Assert.Same(car, superBoy.Pick(token)); token = manager.Park(car); Assert.Same(car, lotHasSpace.Pick(token)); token = manager.Park(car); Assert.Throws <NotFoundException>(() => smartBoy.Pick(token)); token = manager.Park(car); Assert.Throws <NotFoundException>(() => lotNoSpace.Pick(token)); }
public StatisticsViewModel(int userId, ParkingManager pk) { _pk = pk; _userId = userId; RefreshPercent = new StatisticsCommand(new Action(RefreshPercentMethod)); RefreshPercentMethod(); }
public OwnerMenuePage(Action logoutAct, ParkingManager pk) { InitializeComponent(); _pk = pk; _logoutAct = logoutAct; ContentFrame.Content = new AllOperationsPage(_userId, _pk); }
public ClientMenuePage(Action logoutAct, ParkingManager pk) { InitializeComponent(); _pk = pk; _logoutAct = logoutAct; ContentFrame.Content = new CompletedOperations(_userId, _pk); }
public ActiveSession(ParkingManager pm) { InitializeComponent(); this.pm = pm; Active_Sessions.ItemsSource = pm.Active_Sessions(); Progress_Bar.Value = pm.ProgressBar() * 100; }
public AdminForm() { InitializeComponent(); _parkingManager = new ParkingManager(); if (_parkingManager.ActiveSessions.Count != 0) { textBoxPercent.Text = (_parkingManager.ActiveSessions.Count * 100 / (double)_parkingManager.ParkingCapacity).ToString("0.00") + "%"; } else { textBoxPercent.Text = "0%"; } foreach (var session in _parkingManager.ActiveSessions) { textCurrentSessions.Text += session + "\n"; textCurrentSessions.Text += "-------------------------------------------------------------------------------------------"; } foreach (var session in _parkingManager.PastSessions) { textPastSessions.Text += session + "\n"; textPastSessions.Text += "-------------------------------------------------------------------------------------------"; } textIncome.Text = "0"; }
public void RetrieveAllParking() { ParkingManager pm = new ParkingManager(); var lst = pm.RetrieveAll(); Assert.IsTrue(lst.Count > 0); }
public void ParkingManagerTest() { var controller = new ParkingManager(_mock.Object); Assert.IsNotNull(controller); Assert.IsInstanceOfType(controller, typeof(ParkingManager)); }
public IEnumerator Start() { // Delay and find manager yield return(new WaitForEndOfFrame()); manager = GameObject.FindGameObjectWithTag("Manager").GetComponent <ParkingManager> (); }
public LoginPage(ParkingManager pkm, Action navigateToMenue, Action navigateToRegister) { InitializeComponent(); // ViewModel class LoginViewModel viewModelReg = new LoginViewModel(UserRole.Client, pkm, navigateToMenue, navigateToRegister); DataContext = viewModelReg; // Load image from resources Assembly asm = GetType().GetTypeInfo().Assembly; using (Stream stream = asm.GetManifestResourceStream("SmartParkingApp.Client.Images.car_parking_ico.png")) { BitmapImage imgSource = new BitmapImage(); imgSource.BeginInit(); imgSource.StreamSource = stream; imgSource.EndInit(); reg_logo_img.Source = imgSource; } // PasswordBox Password property does not support binding passwdBox.PasswordChanged += (s, e) => { viewModelReg.Password = passwdBox.Password; }; }
public ParkingLot(int id, string name, int numberOfFloors, int numberOfTerminals) { Id = id; Name = name; ParkingManager = new ParkingManager(numberOfFloors, numberOfFloors); }
public void should_report_when_manager_manages_nothing() { var parkingManager = new ParkingManager(); var parkingDirector = new ParkingDirector(parkingManager); parkingDirector.ParkingReport.ToString("markdown").Should().Be("# M 0 0"); }
public PassiveSession(ParkingManager pm, User user) { InitializeComponent(); this.pm = pm; this.user = user; Passive_Sessions.ItemsSource = pm.Passive_Session(user); }
public IHttpActionResult Get() { apiResp = new ApiResponse(); var mng = new ParkingManager(); apiResp.Data = mng.RetrieveAll(); return(Ok(apiResp)); }
public LoginViewModel(string userRole, ParkingManager pkm, Action navToMenue, Action navToRegister) { _userRole = userRole; _pkManager = pkm; Login_Command = new LoginCommand(Login); NavigateToRegister = new LoginCommand(navToRegister); _navToMenue = navToMenue; }
public CompleteOperationsViewModel(int userId, ParkingManager pk, Action <List <ParkingSession> > renewAction) { _pk = pk; RenewCommand = new CompleteOperationCommand(GetCompleted); //GetCompleted(userId, received); _renewAction = renewAction; //Sessions = new ObservableCollection<ParkingSession>(received); }
public ClientWindow(ParkingManager pm, string login) { InitializeComponent(); parkingManager = pm; user = pm.User_Id(login); GreetingText.Text = " Hello, " + user.Name; User_ID.Text = $" Phone {user.Login}"; Car_ID.Text = " Car " + user.CarPlateNumber; }
public void should_not_pick_car_when_the_car_is_not_in_parking_lot() { var parkingManager = new ParkingManager(new ParkingLot(1)); var token = Guid.NewGuid().ToString(); parkingManager.Invoking(p => p.Pick(token)) .ShouldThrow <CarNotFoundException>() .WithMessage("Cannot find the car."); }
public ViewWindow(User user, ParkingManager parkingManager) { this.parkingManager = parkingManager; this.user = user; InitializeComponent(); PhoneNumbLabel.Content = user.Phone; var pastSessions = (from ps in parkingManager.pastSessions where ps.UserId == user.Id select new { EntryDate = ps.EntryDt, ps.ExitDt, ps.TicketNumber, ps.TotalPayment }); if (pastSessions.Count() == 0) { NotFoundSesLabel.Content = "You do not have past parking sessions"; NotFoundSesLabel.Background = new SolidColorBrush(Colors.Red); } else { PSgrid.ItemsSource = pastSessions; } var activeSession = parkingManager.activeSessions.Find(s => s.UserId == user.Id); if (activeSession != null) { EntryDTLabel.Content = activeSession.EntryDt; TicketNumLabel.Content = activeSession.TicketNumber; CurrentPayLabel.Content = parkingManager.GetRemainingCost(activeSession.TicketNumber); CarPlateNumLabel.Content = activeSession.CarPlateNumber; } else { EntryDTLabel.Content = null; TicketNumLabel.Content = null; CurrentPayLabel.Content = 0; CarPlateNumLabel.Content = user.CarPlateNumber; NotFoundLabel.Content = "Not Found"; NotFoundLabel.Background = new SolidColorBrush(Colors.Red); } }
void should_report_when_manager_manages_one_parking_lot() { var parkingLot = ParkingLotBuilder.Build(2, 1); var parkingManager = new ParkingManager(parkingLot); Assert.Equal("M 1 2" + NewLine + " P 1 2", parkingManager.Report.ToString()); }
public AccountPageViewModel(int userId, Action logout, ParkingManager pk) { _pk = pk; LogOutCommand = new AccountCommand(logout); User usr = _pk.CurrentUser; Name = usr.Username; CarPlateNumber = usr.CarPlateNumber; Phone = usr.Phone; }
public void should_success_to_stop_car() { Park park = new Park(1); Car car = new Car("JP123"); ParkingManager manager = new ParkingManager(new List<Park> { park }, null); manager.StopCar(car); Assert.Same(car, park.PickUpCar(car.CarNumber)); }
public void given_a_parkingLot_and_a_parking_manager_when_parking_manager_park_a_car_then_he_can_pick_the_car() { var parkinglot = new OOParkingLot(1); var manager = new ParkingManager(parkinglot); var car = new Car("car"); var carId = manager.Park(car); Assert.AreSame(car, manager.Pick(carId)); }
void should_can_pick_the_car_when_manage_super_parking_boy_and_park_a_car() { var manager = new ParkingManager(new SuperParkingBoy(new ParkingLot(10))); var car = new Car(); var token = manager.Park(car); var pickedCar = manager.Pick(token); Assert.Same(car, pickedCar); }
public void should_park_car_when_manages_parking_lot() { var parkingLot = new ParkingLot(1); var parkingManager = new ParkingManager(parkingLot); var car = new Car(); var token = parkingManager.Park(car); var pickedCar = parkingManager.Pick(token); pickedCar.Should().BeSameAs(car); }
public void should_success_to_ask_parkingboy_to_stop_car_when_one_boy() { Park park = new Park(1); Car car = new Car("JP123"); ParkingBoy parkingBoy = new ParkingBoy(park); ParkingManager manager = new ParkingManager(null, new List<ParkingBoyBase> { parkingBoy }); manager.StopCar(car); Assert.Same(car, park.PickUpCar(car.CarNumber)); }
static void Main(string[] args) { ParkingManager parkingManager = new ParkingManager(); int option = 0; while (option != 4) { option = parkingManager.Menu(); parkingManager.ManageOption(option); } }
public void when_manager_have_one_empty_parking() { ParkingManager manager = new ParkingManager(new List<Park> { new Park(1) }, null); ParkingDirector director = new ParkingDirector(manager); string report = director.GenerateReport(); string[] array = report.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); Assert.Equal(string.Format("{0}P 1 1", Utils.SpaceTwo), array[1]); Assert.Equal("M 1 1", array[0]); }
public IHttpActionResult Delete(Parking parking) { apiResp = new ApiResponse { Message = "Se elimino existosamente" }; var mng = new ParkingManager(); mng.Delete(parking); return(Ok(apiResp)); }
public void should_success_to_ask_parkingboy_to_pick_car_when_two_boys() { ParkingBoy parkingBoy = new ParkingBoy(new Park(1)); SmartParkingBoy smartParkingBoy = new SmartParkingBoy(new Park(1)); Car car = new Car("JP123"); ParkingManager manager = new ParkingManager(null, new List<ParkingBoyBase> { parkingBoy, smartParkingBoy }); manager.StopCar(car); Assert.Same(car, manager.PickUpCar(car.CarNumber)); }
public void should_success_to_stop_car_when_manager_empty_and_boys_full() { ParkingBoy parkingBoy = new ParkingBoy(new Park(0)); ParkingManager manager = new ParkingManager( new List<Park> { new Park(1) }, new List<ParkingBoyBase> { parkingBoy }); Car car = new Car("JP123"); manager.StopCar(car); Assert.Same(car, manager.PickUpCar(car.CarNumber)); }
public void when_manager_have_one_boy_with_no_parking() { var parkingBoy = new ParkingBoy(); ParkingManager manager = new ParkingManager(null, new List<ParkingBoyBase> { parkingBoy }); ParkingDirector director = new ParkingDirector(manager); string report = director.GenerateReport(); string[] array = report.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); Assert.Equal(string.Format("{0}B 0 0", Utils.SpaceTwo), array[1]); Assert.Equal("M 0 0", array[0]); }
public void should_pick_from_his_parkinglot() { var parkinglot = new Parkinglot(1); var parkingManager = new ParkingManager( ParkingBoyFactory.CreateParkingBoy(new Parkinglot(0)), ParkingBoyFactory.CreateSmartParkingBoy(new Parkinglot(0)), ParkingBoyFactory.CreateSuperParkingBoy(new Parkinglot(0)), parkinglot); var car = new Car(); var token = parkinglot.Park(car); Assert.Same(car, parkingManager.Pick(token)); }
public void should_parkingmanager_park_in_parkinglot_with_parkingboy() { var parkingBoy = ParkingBoyFactory.CreateParkingBoy(new Parkinglot()); var parkingManager = new ParkingManager( ParkingBoyFactory.CreateSmartParkingBoy(new Parkinglot(0)), ParkingBoyFactory.CreateSuperParkingBoy(new Parkinglot(0)), parkingBoy, new Parkinglot(0)); var car = new Car(); var token = parkingManager.Park(car); Assert.Same(car, parkingBoy.Pick(token)); }
public void when_manager_have_one_boy_with_first_boy_have_full_parking_and_second_boy_have_one_empty() { var parkingBoy = new ParkingBoy(new Park(1)); parkingBoy.StopCar(new Car("JP123")); var smartBoy = new SmartParkingBoy(new Park(1)); ParkingManager manager = new ParkingManager(null, new List<ParkingBoyBase> { parkingBoy, smartBoy }); ParkingDirector director = new ParkingDirector(manager); string report = director.GenerateReport(); string[] array = report.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); var spaceTwo = Utils.SpaceTwo; Assert.Equal(string.Format("{0}B 0 1", spaceTwo), array[1]); var spaceFour = Utils.SpaceFour; Assert.Equal(string.Format("{0}P 0 1", spaceFour), array[2]); Assert.Equal(string.Format("{0}B 1 1", spaceTwo), array[3]); Assert.Equal(string.Format("{0}P 1 1", spaceFour), array[4]); Assert.Equal("M 1 2", array[0]); }
public ParkingDirector(ParkingManager parkingManager) { this.parkingManager = parkingManager; }
public ParkingDirector(ParkingManager manager) { this.manager = manager; }