コード例 #1
0
        static void Main(string[] args)
        {
            // Assemble your system here from all the classes
            IRfidReader     rfidReader     = new RfidReader();
            IDoor           door           = new DoorSimulator();
            IUsbCharger     usbCharger     = new UsbChargerSimulator();
            IDisplay        display        = new DisplaySimulator();
            ILog            logger         = new FileLogger();
            IChargeControl  chargeControl  = new ChargeControl(usbCharger, display);
            IStationControl stationControl = new StationControl(chargeControl, door, display, rfidReader, logger);

            bool finish = false;

            do
            {
                string input;
                System.Console.WriteLine("Indtast E, O, C, F, A, R: ");
                input = Console.ReadLine();
                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }

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

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

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

                case 'F':
                    chargeControl.ConnectDevice();
                    break;

                case 'A':
                    chargeControl.DisconnectDevice();
                    break;

                case 'R':
                    System.Console.WriteLine("Indtast RFID id: ");
                    string idString = System.Console.ReadLine();

                    int id = Convert.ToInt32(idString);
                    rfidReader.OnRfidRead(id);
                    break;

                default:
                    break;
                }
            } while (!finish);
        }
コード例 #2
0
ファイル: ChargeControlTest.cs プロジェクト: victorduun/E6SWT
 public void ChargeControl_Device_Connected()
 {
     _uut.ConnectDevice();
     Assert.That(_uut.IsConnected, Is.True);
 }