public void RFIDReader_RFIDSetToNewValue_EventFired() { //Act _uut.ReadRFID(456); //Assert Assert.That(_recievedEventArgs, Is.Not.Null); }
public void Setup() { _recievedEventArgs = null; _uut = new RFIDReader(); _uut.ReadRFID(123); _uut.RFIDEvent += ((o, args) => { _recievedEventArgs = args; }); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Console.Write("Test"); var door = new Door(); var rfidReader = new RFIDReader(); IDisplay display = new Display(); var usbCharger = new USBCharger(); var chargeController = new ChargeControl(usbCharger, display); var stationController = new StationControl(rfidReader, display, door, chargeController); // Assemble your system here from all the classes bool finish = false; do { string input; System.Console.WriteLine("Indtast E for exit, O for open, C for close, R for rfid read: "); input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { continue; } switch (input[0]) { case 'E': finish = true; break; case 'O': door.OpenCloseDoor(true); break; case 'C': door.OpenCloseDoor(false); break; case 'R': System.Console.WriteLine("Indtast RFID id: "); string idString = System.Console.ReadLine(); int id = Convert.ToInt32(idString); rfidReader.ReadRFID(id); break; default: break; } } while (!finish); }
static void Main(string[] args) { UsbChargerSimulator usb = new UsbChargerSimulator(); IChargeControl charger = new ChargeControl(usb); IDoor door = new Door(); RFIDReader rfidReader = new RFIDReader(); IDisplay display = new ConcreteDisplay(); StationControl control = new StationControl(charger, door, display, rfidReader); 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.OpenDoor(); break; case 'C': door.CloseDoor(); break; case 'R': System.Console.WriteLine("Indtast RFID id: "); string idString = System.Console.ReadLine(); int id = Convert.ToInt32(idString); rfidReader.ReadRFID(id); break; default: break; } } while (!finish); }
public void ScanRFIDRaisesEvent(int rfid) { rfidReader.ReadRFID(rfid); Assert.That(_rfidEventArgs.RFID, Is.EqualTo(rfid)); }
static void Main(string[] args) { #region Instantiering af dependencies IUsbCharger usbCharger = new UsbCharger(); IDisplay display = new Display(); IDoor door = new Door(); ILogging logging = new LogFileDAL(); IRFIDReader rfidReader = new RFIDReader(); IChargeControl chargeControl = new ChargeControl(usbCharger); IStationControl stationControl = new StationControl(door, rfidReader, chargeControl, logging, display); #endregion bool finish = false; do { string input; System.Console.WriteLine("Indtast E (exit), O (open), C (close), R (rfid), P (phone): "); input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { continue; } switch (input[0]) { case 'E': case 'e': finish = true; break; case 'O': case 'o': if (stationControl.State == PhoneLockerState.DoorOpen) { display.DisplayText("Ladedøren er allerede åben. Frakobl eller tilslut mobil."); break; } else { stationControl.State = PhoneLockerState.DoorOpen; display.DisplayText("Døren er åben"); display.DisplayText("Tilslut telefon"); } break; case 'C': case 'c': if (stationControl.State != PhoneLockerState.DoorOpen) { break; } stationControl.State = PhoneLockerState.Available; display.DisplayText("Døren er lukket"); display.DisplayText("Scan venligst RFID"); break; case 'R': case 'r': Console.Clear(); display.DisplayText("Indtast RFID id: "); string idString = System.Console.ReadLine(); int id = Convert.ToInt32(idString); rfidReader.ReadRFID(id); break; case 'P': case 'p': if (stationControl.State != PhoneLockerState.DoorOpen) { display.DisplayText("Døren er lukket. Åben før der kan tilsluttes."); break; } if (chargeControl.Connected) { chargeControl.Connected = false; display.DisplayText("Telefon frakoblet"); } else { chargeControl.Connected = true; display.DisplayText("Telefon tilsluttet"); } break; default: break; } } while (!finish); }