public AccountBalanceControl(Action <int, Dictionary <string, int> > doNavigation, ParkingSystem system)
 {
     InitializeComponent();
     this.doNavigation        = doNavigation;
     this.parkingSystem       = system;
     this.outputErrorLbl.Text = "";
 }
 public PurchaseControl(Action <int, Dictionary <string, int> > doNavigation, ParkingSystem system)
 {
     InitializeComponent();
     this.doNavigation        = doNavigation;
     this.systemParking       = system;
     this.outputErrorLbl.Text = "";
 }
Beispiel #3
0
 public Parking()
 {
     InitializeComponent();
     parkingSystem = new ParkingSystem(ParkingSystemInitializer.GetUnitOfWorkToInject(Enviroment.DEVELOP));
     PopulateComboBox(this.comboBox1, parkingSystem.CountriesInMemory);
     DoNavigation(NavigationOptions.MAIN_MENU);
 }
Beispiel #4
0
 public HomeControl(Action <int, Dictionary <string, int> > doNavigation, ParkingSystem system)
 {
     InitializeComponent();
     this.doNavigation   = doNavigation;
     this.parkingSystem  = system;
     this.outPutLbl.Text = "";
 }
        private static void Main()
        {
            var parkingSlots = new List <ParkingSlot>
            {
                new ParkingSlot(Data.Data.GetAllSlotsOne())
                {
                    Loaction = "A1"
                },
                new ParkingSlot(Data.Data.GetAllSlotsTwo())
                {
                    Loaction = "B2"
                }
            };
            var floors = new List <Floor>
            {
                new Floor(parkingSlots)
                {
                    FloorNo       = 1,
                    FloorLocation = "South ",
                    ParkingSlots  = parkingSlots.ToList()
                }
            };
            var parkingSystem = new ParkingSystem(floors)
            {
                Name = "Grand Parking System ",
                ParkingSystemLocation = "EPAM, Hyderabad, India ",
                Floors = floors.ToList()
            };


            Console.WriteLine(parkingSystem.ToString());
            Console.Read();
        }
Beispiel #6
0
        public void BigCarTypeInvalidValue()
        {
            int smallParkingSpace  = 9;
            int mediumParkingSpace = 4;
            int bigParkingSpace    = 10;

            var parkingSystem = new ParkingSystem(bigParkingSpace, mediumParkingSpace, smallParkingSpace);

            Assert.ThrowsException <System.ArgumentOutOfRangeException>(() => parkingSystem.AddCar(4));
        }
Beispiel #7
0
 public PurchaseGridControl(Action <int, Dictionary <string, int> > doNavigation, ParkingSystem system)
 {
     InitializeComponent();
     this.doNavigation               = doNavigation;
     this.systemParking              = system;
     startingDatePicker.Format       = DateTimePickerFormat.Custom;
     startingDatePicker.CustomFormat = "MM/dd/yyyy HH:mm";
     endingDatePicker.Format         = DateTimePickerFormat.Custom;
     endingDatePicker.CustomFormat   = "MM/dd/yyyy HH:mm";
     PopulateComboBox(this.comboBox1, system.CountriesInMemory);
     InitializeDataGrid();
 }
Beispiel #8
0
        public void SmallPositiveParkingSpace()
        {
            int smallParkingSpace  = 5;
            int mediumParkingSpace = 8;
            int bigParkingSpace    = 2;

            var parkingSystem = new ParkingSystem(bigParkingSpace, mediumParkingSpace, smallParkingSpace);

            bool expectedSmallParkingSpaceResult = true;
            bool actualSmallParkingSpaceResult   = parkingSystem.AddCar(3);

            Assert.AreEqual(expectedSmallParkingSpaceResult, actualSmallParkingSpaceResult);
        }
Beispiel #9
0
        public void MediumNegativeParkingSpaceOutOfSpots()
        {
            int smallParkingSpace  = 3;
            int mediumParkingSpace = -12;
            int bigParkingSpace    = 6;

            var parkingSystem = new ParkingSystem(bigParkingSpace, mediumParkingSpace, smallParkingSpace);

            bool expectedMediumParkingSpaceResult = false;
            bool actualMediumParkingSpaceResult   = parkingSystem.AddCar(2);

            Assert.AreEqual(expectedMediumParkingSpaceResult, actualMediumParkingSpaceResult);
        }
Beispiel #10
0
        public void MediumPositiveParkingSpace()
        {
            int smallParkingSpace  = 1;
            int mediumParkingSpace = 3;
            int bigParkingSpace    = 6;

            var parkingSystem = new ParkingSystem(bigParkingSpace, mediumParkingSpace, smallParkingSpace);

            bool expectedMediumParkingSpaceResult = true;
            bool actualMediumParkingSpaceResult   = parkingSystem.AddCar(2);

            Assert.AreEqual(expectedMediumParkingSpaceResult, actualMediumParkingSpaceResult);
        }
Beispiel #11
0
        public void BigParkingSpaceInvalidValue()
        {
            int smallParkingSpace  = 2;
            int mediumParkingSpace = 4;
            int bigParkingSpace    = 8;

            var parkingSystem = new ParkingSystem(bigParkingSpace, mediumParkingSpace, smallParkingSpace);

            bool   expectedMediumParkingSpaceResult = parkingSystem.AddCar(1);
            string invalidBooleanResult             = expectedMediumParkingSpaceResult.ToString();

            Assert.AreNotEqual(expectedMediumParkingSpaceResult, invalidBooleanResult);
        }
Beispiel #12
0
        public void BigNegativeParkingSpaceOutOfSpots()
        {
            int smallParkingSpace  = 7;
            int mediumParkingSpace = 5;
            int bigParkingSpace    = -3;

            var parkingSystem = new ParkingSystem(bigParkingSpace, mediumParkingSpace, smallParkingSpace);

            bool expectedBigParkingSpaceResult = false;
            bool actualBigParkingSpaceResult   = parkingSystem.AddCar(1);

            Assert.AreEqual(expectedBigParkingSpaceResult, actualBigParkingSpaceResult);
        }
Beispiel #13
0
        public void Initialize()
        {
            system                = new ParkingSystem(ParkingSystemInitializer.GetUnitOfWorkToInject(Enviroment.TEST));
            unitOfWork            = system.UnitOfWork;
            system.CurrentCountry = system.CountriesInMemory.First(c => c.Name == "URUGUAY");
            notification          = new Notification();
            account               = new Account("098960505");
            account.AddMoneyToBalance("10000");
            string smsMessage = $"ABC 1234 120 {DateTime.Now.AddMinutes(10).ToString(("HH:mm"))}";

            smsValidator = new UySmsValidator();
            sms          = smsValidator.GetInitializedSms(smsMessage);
            sms.SetHourBounds(DateTime.Now, DateTime.Now.AddHours(8));
            purchase = new Purchase(sms, account);
        }
        public void AddCar_WhenCalledOnParkingSystemWithLCExample_ReturnsCorrect()
        {
            // Big 1
            // Medium 2
            // Small 3

            // Arrange
            int big    = 1;
            int medium = 1;
            int small  = 0;

            // Act
            ParkingSystem = new ParkingSystem(big, medium, small);

            // Assert
            Assert.AreEqual(true, ParkingSystem.AddCar(1));
            Assert.AreEqual(true, ParkingSystem.AddCar(2));
            Assert.AreEqual(false, ParkingSystem.AddCar(3));
            Assert.AreEqual(false, ParkingSystem.AddCar(1));
        }
Beispiel #15
0
        public static UserControl CreateUserControl(int userControlCode, Dictionary <string, int> additionalParameters, Action <int, Dictionary <string, int> > doNavigation, ParkingSystem system)
        {
            switch (userControlCode)
            {
            case NavigationOptions.MAIN_MENU:
                return(new HomeControl(doNavigation, system));

            case NavigationOptions.ADD_ACCOUNT:
                return(new RegisterAccountControl(doNavigation, system));

            case NavigationOptions.ADD_BALANCE:
                return(new AccountBalanceControl(doNavigation, system));

            case NavigationOptions.CHECK_PURCHASE:
                return(new CheckPurchaseControl(doNavigation, system));

            case NavigationOptions.PURCHASE_METHOD:
                return(new PurchaseControl(doNavigation, system));

            case NavigationOptions.PURCHASE_GRID:
                return(new PurchaseGridControl(doNavigation, system));

            default:
                return(new HomeControl(doNavigation, system));
            }
        }
Beispiel #16
0
 public ParkingServices(ParkingSystem <T> parkingSysObj)
 {
     _parkingObject = parkingSysObj;
 }
Beispiel #17
0
 public CountryControl(Action <int, Dictionary <string, int> > doNavigation, ParkingSystem system)
 {
     InitializeComponent();
     this.doNavigation  = doNavigation;
     this.systemParking = system;
 }