Exemple #1
0
        static void StoreNewAppoinment(IGarage garage)
        {
            var newAppoinment = new StringBuilder();

            Console.WriteLine("Type name:");
            var name = "Name:" + Console.ReadLine() + ",";

            newAppoinment.Append(name);
            Console.WriteLine("Type date(dd-mm-yyyy):");
            var date = "Date:" + Console.ReadLine() + ",";

            newAppoinment.Append(date);
            Console.WriteLine("Type start time(hh.mm):");
            var startTime = "Start Time:" + Console.ReadLine() + ",";

            newAppoinment.Append(startTime);
            Console.WriteLine("Type end time (hh.mm):");
            var endTime = "End Time:" + Console.ReadLine() + ",";

            newAppoinment.Append(endTime);

            Console.WriteLine("Type a description:");
            var description = "Description:" + Console.ReadLine();

            newAppoinment.Append(description);

            var bookedNewAppoinment = garage.StoreNewAppointment(newAppoinment.ToString());

            Console.WriteLine(bookedNewAppoinment);
        }
Exemple #2
0
 private void CheckIfRobotExistInGarage(string robotName, IGarage garage)
 {
     if (!garage.Robots.ContainsKey(robotName))
     {
         throw new ArgumentException(string.Format(ExceptionMessages.InexistingRobot, robotName));
     }
 }
        public Controller()
        {
            this.garage     = new Garage();
            this.procedures = new Dictionary <RobotProcedures, IProcedure>();

            AddProcedures();
        }
 public Controller()
 {
     this.robotFactory = new RobotFactory();
     this.garage       = new Garage();
     this.procedures   = new Dictionary <string, IProcedure>();
     this.InitializeProcedures();
 }
 public Api(Server server, IAccount account = null, IGarage garage = null, IBannedIPs bannedIps = null, IChatApi chat = null, IServerApi serverApi = null)
 {
     Account  = account ?? new Account();
     Garage   = garage ?? new Garage();
     BannedIP = bannedIps ?? new BannedIPs();
     Chat     = chat ?? new Chat(server.Lobbies, server.Logger, server.Api);
     Server   = serverApi ?? new ServerApi(server);
 }
Exemple #6
0
        /**
         * Interference between tests necessitates creation of different
         * vehicle instances for each test
         **/
        public GarageTests()
        {
            var gName    = "GarageNo6";
            var capacity = 42u;

            ghandler  = GarageHandler.Instance;
            vregistry = VehicleRegistry.Instance;
            garage    = ghandler.CreateGarage(gName, capacity);
        }
Exemple #7
0
 public Controller()
 {
     procedureChip   = new Chip();
     procedureCharge = new Charge();
     procedurePolish = new Polish();
     procedureRest   = new Rest();
     procedureTeach  = new TechCheck();
     procedureWork   = new Work();
     garage          = new Garage();
 }
 public Controller()
 {
     this.garage    = new Garage();
     this.charge    = new Charge();
     this.chip      = new Chip();
     this.polish    = new Polish();
     this.rest      = new Rest();
     this.techCheck = new TechCheck();
     this.work      = new Work();
 }
Exemple #9
0
        static void ShowBookedAppointments(IGarage garage)
        {
            var showAvailability = garage.ShowAvailableAppointments();

            Console.WriteLine("Show timetable available mechanics:");
            Console.WriteLine("_______________________________________________________________");
            Console.WriteLine(showAvailability);
            Console.WriteLine("_______________________________________________________________");
            Console.WriteLine("");
        }
Exemple #10
0
        public Controller()
        {
            this.garage = new Garage();

            this.chargeProcedure    = new Charge();
            this.chipProcedure      = new Chip();
            this.polishProcedure    = new Polish();
            this.restProcedure      = new Rest();
            this.techCheckProcedure = new TechCheck();
            this.workProcedure      = new Work();
        }
Exemple #11
0
        public Controller()
        {
            this._polish    = new Polish();
            this._chip      = new Chip();
            this._techCheck = new TechCheck();
            this._work      = new Work();
            this._charge    = new Charge();
            this._rest      = new Rest();

            this._allProcedures = new List <IProcedure>();
            this._garage        = new Garage();
        }
Exemple #12
0
 public Controller()
 {
     garage     = new Garage();
     procedures = new Dictionary <string, IProcedure>()
     {
         { "Charge", new Charge() },
         { "Chip", new Chip() },
         { "Polish", new Polish() },
         { "Rest", new Rest() },
         { "Work", new Work() },
         { "TechCheck", new TechCheck() }
     };
 }
Exemple #13
0
        private async Task <string> MoveGarage(IGarage garage, Intent intent)
        {
            var action        = intent.Slots["action"].Resolution?.Authorities.FirstOrDefault()?.Values.FirstOrDefault()?.Value.Id;
            var currentStatus = await garage.GetGarageStatus();

            if (currentStatus.ToString() == action)
            {
                return($"Garage is already {ConvertStatus(currentStatus)}");
            }
            await garage.ToggleGarage();

            return($"Garage is {action}ing");
        }
Exemple #14
0
        private async Task <string> GetStatus(IGarage garage, Intent intent)
        {
            string askedStatus = null;

            if (intent.Slots.ContainsKey("status"))
            {
                askedStatus = intent.Slots["status"].Resolution?.Authorities.FirstOrDefault()?.Values.FirstOrDefault()?.Value.Id;
            }

            int value = await garage.GetGarageStatus();

            var prefix = askedStatus == null ? "" : (askedStatus == value.ToString() ? "Yes, " : "No, ");

            return($"{prefix}the garage is {ConvertStatus(value)}");
        }
        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="garage">Referens till garage</param>
        /// <param name="ui">Referens till ui</param>
        /// <exception cref="System.NullReferenceException">Kan kastas om referensen till garage eller ui är null</exception>
        public GarageHandler(IGarage <ICanBeParkedInGarage> garage, IUI ui)
        {
            if (garage == null)
            {
                throw new NullReferenceException("NullReferenceException. GarageHandler.GarageHandler(). Garage referensen är null");
            }

            if (ui == null)
            {
                throw new NullReferenceException("NullReferenceException. GarageHandler.GarageHandler(). ui referensen är null");
            }

            Ui     = ui;
            Garage = garage;
            GuidId = garage.GarageID;
        }
Exemple #16
0
        static void Main(string[] args)
        {
            GarageHandler      gh        = GarageHandler.Instance;
            VehicleRegistry    vregistry = VehicleRegistry.Instance;
            IGarage <IVehicle> garage    = gh.CreateGarage("Garage01", 42);

            Console.WriteLine($"{garage.ToString()}");
            var car1 = vregistry.CreateVehicle <Car>("ABC123", "Green");
            var car2 = vregistry.CreateVehicle <Car>("DEF123", "White");
            var car3 = vregistry.CreateVehicle <Car>("ABC456", "Red", FuelType.FuelCell);
            var car4 = vregistry.CreateVehicle <Car>("DEF456", "Yellow");
            var car5 = vregistry.CreateVehicle <Car>("XYZ999", "Black", FuelType.Ethanol);

            gh.ParkVehicle(garage, car1);
            gh.ParkVehicle(garage, car2);
            gh.ParkVehicle(garage, car1);
            gh.ParkVehicle(garage, car5);

            Console.WriteLine("---After duplicate instance added---");

            Console.WriteLine($"{garage.ToString()}");

            garage.EmptyGarage();
            Console.WriteLine("---After emptying the garage---");
            Console.WriteLine($"{garage.ToString()}");

            gh.ParkVehicle(garage, car1);
            gh.ParkVehicle(garage, car2);
            gh.ParkVehicle(garage, car3);
            gh.ParkVehicle(garage, car4);
            gh.ParkVehicle(garage, car5);

            Console.WriteLine("---After adding 5 cars---");
            Console.WriteLine($"{garage.ToString()}");

            // Remove one of the parked cars
            var removed = gh.RemoveVehicle(garage, car2);

            Console.WriteLine($"Removed: {removed}");

            Console.WriteLine("---After removing car2---");
            Console.WriteLine($"{garage.ToString()}");
        }
Exemple #17
0
        static void Main(string[] args)
        {
            string  userInput   = "";
            IHelper helper      = new InstanceHelper();
            ICommon common      = new Common(helper);
            var     buildGarage = new BookingPlain();
            IGarage garage      = buildGarage.BuildBooking(common, helper);

            Console.WriteLine("Type 'new' to store a new appoinment, 'view' to show available time or 'exit' to stop");

            while (userInput != "exit")
            {
                Console.Write("> ");
                userInput = Console.ReadLine().ToLower();

                switch (userInput)
                {
                case "exit":
                    break;

                case "new":
                {
                    StoreNewAppoinment(garage);
                    break;
                }

                case "view":
                {
                    ShowBookedAppointments(garage);
                    break;
                }

                default:
                {
                    Console.WriteLine("\"{0}\" is not a recognized command.", userInput);
                    break;
                }
                }
            }
        }
Exemple #18
0
 public Controller()
 {
     garage     = new Garage();
     procedures = new Dictionary <ProcedureType, IProcedure>();
     SeedProcedures();
 }
Exemple #19
0
 public GarageHandler(IGarage <IVehicle> garage, IUtil util)
 {
     this.garage = garage;
     this.util   = util;
 }
 public LittleKingdom(ICar car, IGarage garage)
 {
     Car    = car;
     Garage = garage;
 }
 // ReSharper disable UnusedMember.Global : constructors are used through reflection
 public WithMultipleContructorsOfSameParameterNumber(IGarage garage)
 {
     Garage = garage;
 }
Exemple #22
0
 public void SetUp()
 {
     _garage = new PlainTextSource();
 }
Exemple #23
0
 public TuneCommand(IList <string> arguments, IGarage garage) : base(arguments)
 {
     this.garage = garage;
 }
Exemple #24
0
 public CarHandler(IGarage showroom)
 {
     _cars = showroom;
 }
 public Controller()
 {
     _garage     = new Garage();
     _procedures = new List <IProcedure>();
 }
Exemple #26
0
 public GarageHandler(IGarage <IVehicle> garage)
 {
     this.garage = garage;
 }
 public NewCarHandler(IGarage garage)
 {
     _garage = garage;
 }
Exemple #28
0
 static void MaintainVehicle(IGarage v)
 {
     v.MaintainVehicle();
 }
 public Controller()
 {
     garage = new Garage();
 }
Exemple #30
0
 public void AddGarages(IGarage garage)
 {
     _listofGarages.Add(garage);
     _numberOfGarages++;
 }
 public Controller()
 {
     this.garage     = new Garage();
     this.procedures = new Dictionary <ProcedureType, IProcedure>();
     this.SeedProcedures();
 }
Exemple #32
0
 public ParticipateCommand(IList <string> arguments, ICarManager carManager, IGarage garage)
     : base(arguments)
 {
     this.carManager = carManager;
     this.garage     = garage;
 }
        /// <summary>
        /// Metoden hanterar inmatning av kommandon från ui
        /// Hantering av inmatning av namn på garage och dess kapacitet
        /// </summary>
        /// <returns>enum MenuInputResult med olika värden beroende på användarens kommando</returns>
        private MenuInputResult HandleInput()
        {
            MenuInputResult result = MenuInputResult.NA;

            // Inläsning av namnet på garaget
            string strInput = this.Ui.ReadLine();

            if (!String.IsNullOrWhiteSpace(strInput))
            {
                strInput = strInput.Trim();
                if (strInput.StartsWith('0'))
                {// Användaren har valt att avsluta programmet. Återgå till huvudmenyn
                    result = MenuInputResult.TO_MAIN_MENU;
                }
                else
                {
                    // Nu har vi namnet på garaget
                    string strGarageName = strInput;

                    // Nu skall vi läsa in kapacitet
                    Ui.WriteLine("0. För att återgå till huvudmenyn");
                    Ui.WriteLine("Ange antal platser i garaget ");

                    int iCapacity = 0;

                    // Inläsning av garagets kapacitet
                    strInput = this.Ui.ReadLine();

                    if (!String.IsNullOrWhiteSpace(strInput))
                    {
                        strInput = strInput.Trim();

                        if (strInput.StartsWith('0'))
                        {// Användaren har valt att avsluta programmet. Återgå till huvudmenyn
                            result = MenuInputResult.TO_MAIN_MENU;
                        }
                        else
                        {
                            string strCapacity = strInput;

                            if (Int32.TryParse(strCapacity, out iCapacity) && iCapacity > 0)
                            {// Vi har en capacity
                                // Skapa ett nytt garage
                                IGarageFactory garageFactory          = new GarageFactory();
                                IGarage <ICanBeParkedInGarage> garage = garageFactory.CreateGarage(Guid.NewGuid(), strGarageName, iCapacity);

                                // Skapa en handler som skall hantera det nya garaget
                                IGarageHandler garageHandler = new Excercise5Garage.GarageHandler.GarageHandler(garage, this.Ui);

                                // Lägg till handlern till en lista med olika garagehandlers
                                this.GarageHandlers.Add(garageHandler);
                                Ui.WriteLine("Skapade garage. " + garage);

                                Ui.WriteLine("Return för att återgå till huvudmenyn");
                                this.Ui.ReadLine();
                                result = MenuInputResult.TO_MAIN_MENU;
                            }
                            else
                            {
                                result = MenuInputResult.WRONG_INPUT;
                            }
                        }
                    }
                    else
                    {
                        result = MenuInputResult.WRONG_INPUT;
                    }
                }
            }
            else
            {
                result = MenuInputResult.TO_MAIN_MENU;
            }

            return(result);
        }
 public LittleKingdom(ICar car, IGarage garage)
 {
     Car = car;
     Garage = garage;
 }