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); }
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); }
public void RfidChanged_IdSetToNewValue_EventFired() { _uut.OnRfidRead(100); Assert.That(_eventArgs, Is.Not.Null); }
public void TestRfidRaiseEvent() { _uut.OnRfidRead(1234); Assert.That(_recievedRfidEventArgs, Is.Not.Null); }
static void Main(string[] args) { // Assemble your system here from all the classes //DoorSimulator doorSimulator = new DoorSimulator(); IUsbCharger charger = new UsbChargerSimulator(); IDisplay display = new Display(); IChargeControl chargeControl = new ChargeControl(charger, display); IDoor doorSimulator = new DoorSimulator(); //RfidReaderSimulator rfidReaderSimulator = new RfidReaderSimulator(); IRfidReader rfidReaderSimulator = new RfidReaderSimulator(); IFileLog fileLog = new FileLog(); StationControl stationControl = new StationControl(doorSimulator, rfidReaderSimulator, chargeControl, fileLog, display); //Det man indtaster simulerer det som brugeren fysisk gør. //Fra program bliver der sat gang i Events, som StationControl får besked om bool finish = false; do { string input; System.Console.WriteLine("Indtast E, O, C, R, Y, N: "); input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { continue; } switch (input[0]) { case 'E': finish = true; break; case 'O': doorSimulator.OnDoorOpen(); break; case 'C': doorSimulator.OnDoorClose(); break; case 'R': System.Console.WriteLine("Indtast RFID id: "); string idString = System.Console.ReadLine(); int id = Convert.ToInt32(idString); rfidReaderSimulator.OnRfidRead(id); break; case 'Y': charger.SimulateConnected(true); break; case 'N': charger.SimulateConnected(false); break; default: break; } } while (!finish); }
public void OnRfidRead_OnRfidReadCalled_EventFired() { _uut.OnRfidRead(1); Assert.That(_recievedRfidDetectedEventArgs, Is.Not.Null); }
public void RFIDDetectedValue_IsUpdated_WhenIDIsRead_FromUserInput(int oldId, int newId) { _uut.RFIDDetectedValue = oldId; _uut.OnRfidRead(newId); Assert.That(_uut.RFIDDetectedValue, Is.EqualTo(newId)); }