public void TestEventIsNotNullAfterRFIDRead(int ID) { //act uut.OnRfidRead(ID); //assert Assert.That(RFIDArgs, Is.Not.Null); }
public void Setup() { _revievedEventArgs = null; _uut = new RFIDReader(); _uut.OnRfidRead(10); _uut.RFIDReaderEvent += (o, args) => { _revievedEventArgs = args; }; }
public void SetUp() { receivedEventArgs_ = null; uut_ = new RFIDReader(); uut_.OnRfidRead(1111); uut_.RFIDEvent += (o, args) => { receivedEventArgs_ = args; }; }
static void Main(string[] args) { IDisplay display = new Display(); IDoor door = new Door(display); IRFIDReader rfidReader = new RFIDReader(); IUsbCharger charger = new UsbChargerSimulator(); ILogFile log = new LogFile(); StationControl stationControl = new StationControl(door, rfidReader, display, charger, log); // Assemble your system here from all the classes 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.OnRfidRead(id); break; default: break; } } while (!finish); }
public void OnRfidRead_EventFired() { // Arrange var uut = new RFIDReader(); RFIDEventArgs receivedEventArgs = null; uut.RFIDChangedEvent += (o, args) => { receivedEventArgs = args; }; // Act uut.OnRfidRead(1); // Assert Assert.That(receivedEventArgs, Is.Not.Null); }
public static void Main(string[] args) { // Assemble your system here from all the classes Door _door = new Door(); RFIDReader _rfid = new RFIDReader(); PrintToDisplay _printToDisplay = new PrintToDisplay(); Display _display = new Display(_printToDisplay); LogDisplay _logDisplay = new LogDisplay(); Log _log = new Log(_logDisplay); UsbCharger _charger = new UsbCharger(); ChargeControl _chargeControl = new ChargeControl(_display, _charger); StationControl _stationControl = new StationControl(_chargeControl, _door, _display, _rfid, _log); bool finish = false; string input; System.Console.WriteLine(" -----------------------------------------\n\n " + " INDTAST FOR AT FORTAGE EN HANDLING\n " + " E (Exit)\n " + " O (Open)\n " + " C (Closed)\n " + " R (Read RFID)\n " + " G (Guide)\n\n" + "-----------------------------------------"); do { input = Console.ReadLine(); if (string.IsNullOrEmpty(input)) { continue; } switch (input[0]) { case 'E': case 'e': finish = true; break; case 'O': case 'o': _door.DoorOpen(); break; case 'C': case 'c': _door.DoorClosed(); break; case 'R': case 'r': System.Console.WriteLine("Indtast RFID id: "); string idString = System.Console.ReadLine(); int id = Convert.ToInt32(idString); if (id > 0) { _rfid.OnRfidRead(id); } else { System.Console.WriteLine("RFID er ugyldigt! RFID kan ikke være et negativt tal eller over 10.000!"); } break; case 'G': case 'g': System.Console.WriteLine(" -----------------------------------------\n\n " + " 1. Open the door of the Ladeskab\n " + " 2. Insert your phone into the Ladeskab\n " + " 3. Connect your phone to the USB charger inside the Ladeskab\n " + " 4. CLose the door of the Ladeskab\n " + " 5. Read your RFID tag on the RFID-Reader\n " + " !!Congratulations! Your phone is now charging!!\n\n" + " Note: To remove your phone from the Ladeskab read your RFID tag on the RFID Reader and open the door to the Ladeskab\n\n" + "-----------------------------------------"); break; default: break; } } while (!finish); //test af push }
static void Main(string[] args) { // Assemble your system here from all the classes IDoor door = new DoorSimulator(); IRFID rfidReader = new RFIDReader(); ILogger fileLogger = new FileLogger(); IUsbCharger usbCharger = new UsbChargerSimulator(); IDisplay display = new ConsoleDisplay(); IChargeControl chargeControl = new ChargeControl(display, usbCharger); StationControl StationController = new StationControl(chargeControl, door, display, fileLogger, rfidReader); Console.WriteLine("E for Exit, O for opening the door, C for closing the door, R to read an RFID-tag"); Console.WriteLine("K for connecting phone to charger, L for disconnecting phone from charger"); bool finish = false; do { System.Console.WriteLine("Indtast E, O, C, R, K, L: "); string input; 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; case 'K': if (door.DoorIsOpen && !usbCharger.Connected) { usbCharger.SimulateConnected(true); Console.WriteLine("Telefon tilsluttet"); } else { Console.WriteLine("Laderen er optaget ellers er døren ikke åben"); } break; case 'L': if (door.DoorIsOpen && usbCharger.Connected) { usbCharger.SimulateConnected(false); Console.WriteLine("Telefon taget ud af charger"); } else { Console.WriteLine("Døren skal være åben og laderen optaget før du kan tage den ud af opladning"); } break; default: break; } } while (!finish); }
public void Set_recievedRFID_20() { _uut.OnRfidRead(20); Assert.That(_revievedEventArgs.RFID, Is.EqualTo(20)); }
static void Main(string[] args) { // Assemble your system here from all the classes IDoor door = new Door(); IDisplay display = new Display(); IRFID rfidReader = new RFIDReader(); IUsbCharger usbCharger = new UsbChargerSimulator(); StationControl stationControl = new StationControl(door, rfidReader, usbCharger, display); // Udskriver de forskellige muligheder brugeren har i starten System.Console.WriteLine("Indtast 'E' for 'Exit'\n" + "Indtast 'O' for 'Open door'\n" + "Indtast 'C' for 'Close door'\n" + "Indtast 'K' for 'Connect phone'\n" + "Indtast 'R' for 'RFID'"); // Kalder chargeSurveillance hvert 5. sekund - udskriver status og stopper opladning når fuldt opladt. var timer = new System.Threading.Timer( e => stationControl.chargeSurveillance(), null, TimeSpan.Zero, TimeSpan.FromSeconds(5)); bool finish = false; do { string input; //Console.WriteLine("Indtast E, O, C, K, 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 'K': bool isconnect = usbCharger.Connected; while (isconnect == false) { Console.WriteLine("Telefon ikke tilsluttet"); break; } Console.WriteLine("Telefon tilsluttet. Luk venligst døren"); 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 RFIDReaderNewValue_EventFired() { uut_.OnRfidRead(1112); Assert.That(receivedEventArgs_, Is.Not.Null); }