Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // Assemble your system here from all the classes
            IDoorSimulator       door           = new DoorSimulator();
            IUsbCharger          usb            = new UsbChargerSimulator();
            IDisplaySimulator    display        = new DisplaySimulator();
            IWriteSimulator      write          = new WriteSimulator();
            ILogFileSimulator    log            = new LogFileSimulator(write);
            IRfidReaderSimulator rfidReader     = new RfidReaderSimulator();
            IChargeControl       chargeControl  = new ChargeControl(display, usb);
            StationControl       stationControl = new StationControl(door, chargeControl, display, log, rfidReader);

            bool finish = false;

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

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

                case 'o':
                    door.OnDoorOpen(true);
                    Console.WriteLine("Tryk T");
                    break;

                case 't':
                    usb.SimulateConnected(true);
                    break;

                case 'c':
                    door.OnDoorClose(true);
                    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);
        }
Ejemplo n.º 3
0
    static void Main(string[] args)
    {
        // Assemble your system here from all the classes
        DoorSimulator       door           = new DoorSimulator();
        RfidReaderSimulator rfidReader     = new RfidReaderSimulator();
        EncapsulateDisplay  encapDisplay   = new EncapsulateDisplay();
        DisplaySimulator    display        = new DisplaySimulator(encapDisplay);
        UsbChargerSimulator usbCharger     = new UsbChargerSimulator();
        ChargeControl       chargeControl  = new ChargeControl(usbCharger, display);
        StationControl      stationControl = new StationControl(chargeControl, door, display, rfidReader);

        usbCharger.SimulateConnected(true);

        bool finish = false;

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

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

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

            case 'C':
                door.OnDoorClose();
                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);
    }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            // Assemble your system here from all the classes
            Door _door = new Door();
            RfidReaderSimulator _rfid           = new RfidReaderSimulator();
            UsbChargerSimulator _usbCharger     = new UsbChargerSimulator();
            DisplayOutput       _displayOutput  = new DisplayOutput();
            DisplaySimulator    _display        = new DisplaySimulator(_displayOutput);
            ChargeControl       _chargeControl  = new ChargeControl(_display, _usbCharger);
            LogOutput           _logOutput      = new LogOutput();
            LogfileWriter       _logfile        = new LogfileWriter(_logOutput);
            StationControl      _stationControl = new StationControl(_chargeControl, _door, _rfid, _display, _logfile);
            bool finish = false;

            System.Console.WriteLine("Indtast:\n" +
                                     "(E) Exit\n" +
                                     "(O) Open\n" +
                                     "(C) Close\n" +
                                     "(R) Read RF-ID");

            do
            {
                string input = null;

                // Gate the blocking ReadLine function
                if (Console.KeyAvailable)
                {
                    input = Console.ReadLine();
                }
                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }

                input = input.ToUpper();

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

                case 'O':
                    _door.DoorOpened();
                    break;

                case 'C':
                    _door.DoorClosed();
                    break;

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

                    int id = Convert.ToInt32(idString);
                    _rfid.ScanRfidTag(id);

                    break;

                default:
                    break;
                }

                System.Console.WriteLine("Indtast:\n" +
                                         "(E) Exit\n" +
                                         "(O) Open\n" +
                                         "(C) Close\n" +
                                         "(R) Read RF-ID");
            } while (!finish);
        }
Ejemplo n.º 5
0
 public void Setup()
 {
     _encapsulateIDisplay = Substitute.For <IEncapsulateIDisplay>();
     _uut = new DisplaySimulator(_encapsulateIDisplay);
 }
Ejemplo n.º 6
0
 public void Setup()
 {
     _uut = new DisplaySimulator();
 }
Ejemplo n.º 7
0
 public void Setup()
 {
     // Common Arrange:
     output = Substitute.For <IDisplayOutput>();
     uut    = new DisplaySimulator(output);
 }
Ejemplo n.º 8
0
 public void Setup()
 {
     _displaySimulator = new DisplaySimulator();
 }