示例#1
0
        static void Main(string[] args)
        {
            MyConsole           myConsole     = new MyConsole();
            HdDisplay           display       = new HdDisplay(myConsole);
            UsbChargerSimulator usbCharger    = new UsbChargerSimulator();
            ChargeControl       chargeControl = new ChargeControl(usbCharger, display);
            Door        door       = new Door();
            TextLogger  textLogger = new TextLogger();
            LogFile     logFile    = new LogFile(textLogger);
            RfidScanner scanner    = new RfidScanner();

            StationControl stationControl = new StationControl(chargeControl, door, scanner, display, logFile);

            bool finish = false;

            do
            {
                string input;
                System.Console.WriteLine("E: Exit \nO: Open\nC: Close\nS: Scan RFID");
                System.Console.WriteLine("Enter: E, O, C, S: ");
                input = Console.ReadLine().ToUpper();
                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }

                switch (input[0])
                {
                case 'E':
                    finish = true;
                    break;

                case 'O':
                    door.DoorOpen();
                    break;

                case 'C':
                    door.DoorClose();
                    break;

                case 'S':
                    System.Console.WriteLine("Enter RFID: ");
                    string idString = System.Console.ReadLine();

                    int id = Convert.ToInt32(idString);
                    scanner.ScanId(id);
                    break;

                default:
                    break;
                }
            } while (!finish);
        }
示例#2
0
 public void Setup()
 {
     _myConsole = Substitute.For <IMyConsole>();
     _display   = new HdDisplay(_myConsole);
 }