static void Main(string[] args) { // Assemble your system here from all the classes DoorSimulator door = new DoorSimulator(); Display display = new Display(); UsbChargerSimulator UsbCharger = new UsbChargerSimulator(); ChargeControl charger = new ChargeControl(UsbCharger, display); RfidReaderSimulator rfidReader = new RfidReaderSimulator(); LogFile log = new LogFile(); StationControl station = new StationControl(charger, door, display, rfidReader, log); 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.UnlockDoor(); break; case 'C': door.LockDoor(); break; case 'R': System.Console.WriteLine("Indtast RFID id: (Fungerer kun hvis tilstand = Available)"); string idString = System.Console.ReadLine(); try { int id = Convert.ToInt32(idString); rfidReader.SimulateReading(id); } catch (FormatException) { Console.WriteLine("Vil du venligst indtaste et tal?"); } break; default: break; } } while (!finish); }
public void Setup() { door = new DoorSimulator(); numberOfEvents = 0; door.DoorOpenEvent += Door_OpenEvent; door.DoorCloseEvent += Door_CloseEvent; }
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); }
public void Setup() { _receivedEventArgsOpened = null; _receivedEventArgsClosed = null; _uut = new DoorSimulator(); _uut.DoorOpenEvent += ((o, args) => { _receivedEventArgsOpened = args; }); _uut.DoorCloseEvent += ((o, args) => { _receivedEventArgsClosed = args; }); }
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 IUsbCharger charger = new UsbChargerSimulator(); DoorSimulator door = new DoorSimulator(); rfidReader rfid = new rfidReader(); IDisplay display = new Display(); ILog log = new LogFile(); ChargeControl chargeControl = new ChargeControl(charger, display); StationControl station = new StationControl(door, chargeControl, rfid, display, log); bool finish = false; do { string input; System.Console.WriteLine("Indtast E, O, C, R, T: "); 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); rfid.ScanRFID(id); break; case 'T': chargeControl.IsConnectedToggle(); break; default: break; } } while (!finish); }
public void Setup() { _recievedDoorEventArgs = null; _uut = new DoorSimulator(); _uut.DoorEvent += (o, args) => { _recievedDoorEventArgs = args; }; }
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 Setup() { _eventArgs = null; _uut = new DoorSimulator(); _uut.IsOpenValueEvent += (o, args) => { _eventArgs = args; }; _stringWriter = new StringWriter(); System.Console.SetOut(_stringWriter); }
public void Setup() { //arrange uut = new DoorSimulator(); //Door closed and unlocked by default openDoorArgs = null; closeDoorArgs = null; uut.closeDoorEvent += (o, args) => { closeDoorArgs = args; }; uut.openDoorEvent += (o, args) => { openDoorArgs = args; }; }
public void Setup() { _doorOpenEventArgs = null; _doorCloseEventArgs = null; _uut = new DoorSimulator(); _uut.DoorOpenEvent += (o, args) => { _doorOpenEventArgs = args; }; _uut.DoorCloseEvent += (o, args) => { _doorCloseEventArgs = args; }; }
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); }
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 SetUp() { _reciecedDoorArg = null; _uut = new DoorSimulator(); _uut.DoorChangedEvent += (o, args) => _reciecedDoorArg = args; }
public void Setup() { _receivedEventArgs = null; _door = new DoorSimulator(); _door.DoorStateChangedEvent += (o, args) => { _receivedEventArgs = args; }; }
public void Setup() { _doorSimulator = new DoorSimulator(); }
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); }