public void Setup() { _receivedEventArgs = null; _uut = new RFIDReaderSimulator(); _uut.RFIDValueEvent += (o, args) => { _receivedEventArgs = args; }; }
static void Main(string[] args) { Display _display = new Display(); UsbChargerSimulator _usbChargerSimulator = new UsbChargerSimulator(); ChargeControl _chargeControl = new ChargeControl(_display, _usbChargerSimulator); RFIDReaderSimulator _RFIDReaderSimulator = new RFIDReaderSimulator(); DoorSimulator _doorSimulator = new DoorSimulator(); LogFile _logfile = new LogFile(); StationControl _stationControl = new StationControl(_display, _doorSimulator, _logfile, _RFIDReaderSimulator, _chargeControl); bool finish = false; System.Console.WriteLine("Indtast E = Exit\nO = Open\nC = Close\nR = RFID Read\nT = Tilslut/Fjern telefon"); do { string input; input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { continue; } switch (input[0]) { case 'E': finish = true; break; case 'O': _doorSimulator.SimulateDoorOpen(); break; case 'C': _doorSimulator.SimulateDoorClose(); break; case 'T': if (_stationControl._state == StationControl.LadeskabState.DoorOpen) { _usbChargerSimulator.SimulateConnected(!_usbChargerSimulator.Connected); Console.WriteLine("Telephone connected: " + _usbChargerSimulator.Connected); } else { Console.WriteLine("Open door first!"); } break; case 'R': Console.WriteLine("Indtast RFID id: "); string idString = Console.ReadLine(); int id = Convert.ToInt32(idString); _RFIDReaderSimulator.SimulateReadRFID(id); break; default: break; } } while (!finish); }
static void Main(string[] args) { // Assemble your system here from all the classes IDoor _door = new Door(); IUsbCharger _usbCharger = new UsbChargerSimulator(); IDisplay _display = new Display(); IRFIDReader _rfidReader = new RFIDReaderSimulator(); ILogWriter _log = new LogWriter(); IChargeControl _charge = new ChargeControl(_display, _usbCharger); StationControl stationControl = new StationControl(_door, _display, _rfidReader, _log, _charge); int runs = 0; bool finish = false; do { string input; if (runs == 0) { System.Console.WriteLine("Welcome to ChargingLocker"); System.Console.WriteLine("Type 'Open' to open locker door"); System.Console.WriteLine("Type 'Close' to close locker door"); System.Console.WriteLine("Type 'Scan' to scan your RFID tag"); System.Console.WriteLine("Type 'Exit' to exit program"); } else { System.Console.WriteLine("Type 'List' to show all options"); } runs = 1; System.Console.Write("Input: "); input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { continue; } switch (input) { case "Exit" or "exit": finish = true; break; case "Open" or "open": if (_door._lock == true) { _display.DisplayDoorIsLocked(); } else { _door.DoorOpened(); } break; case "Close" or "close": if (_door._lock == true) { _display.DisplayDoorIsLocked(); } else { _door.DoorClosed(); } break; case "Scan" or "scan": System.Console.WriteLine("Indtast RFID id: "); string idString = System.Console.ReadLine(); int id = Convert.ToInt32(idString); stationControl.runProgram(id); break; case "List" or "list": runs = 0; break; default: break; } } while (!finish); }