public void ElevatorOneTest() { int MinFloor = 0, MaxFloors = 10, CurrentFloor = 0; List <int> RequestList = new List <int>(); RequestList.Add(5); RequestList.Add(4); RequestList.Add(11); RequestList.Add(-1); AbstractElevator _ElevatorOne = new ElevatorOne(MinFloor, MaxFloors, CurrentFloor); //manual IOC without unity Console.WriteLine("Requested floors are "); foreach (var item in RequestList) { Console.WriteLine(item); } foreach (var item in RequestList) { CurrentFloor = _ElevatorOne.MoveUp(CurrentFloor, item); } foreach (var item in RequestList) { CurrentFloor = _ElevatorOne.MoveDown(CurrentFloor, item); } Console.ReadLine(); }
public static void Main(string[] args) { int MinFloor = 0; int MaxFloor = 0; int CurrentFloor = 0; Console.WriteLine("How many floors are there in the building.??"); string input = Console.ReadLine(); List <int> RequestList = new List <int>(); if (Int32.TryParse(input, out MaxFloor)) { RequestList = GetRequestsFromUser(MinFloor, MaxFloor); } else { Console.WriteLine("Invalid input."); } #region Abstract Elevator AbstractElevator _AbstractElevator = new ElevatorOne(MinFloor, MaxFloor, CurrentFloor); ElevatorService AbstractElevatorService = new ElevatorService(_AbstractElevator); int AbstractElevatorStatus = AbstractElevatorService.AbstractElevatorCall(RequestList); //_AbstractElevator = new ElevatorTwo(MinFloor, MaxFloor, CurrentFloor); #endregion #region Interface Elevator //IElevator _IElevator = new ElevatorFour(MinFloor, MaxFloor, CurrentFloor); //ElevatorService InterfaceElevatorService = new ElevatorService(_IElevator); //int InterfaceElevatorStatus = InterfaceElevatorService.InterfaceElevatorCall(RequestList); #endregion Console.ReadLine(); }