예제 #1
0
        static void Main(string[] args)
        {
            bool finish = false;

            //Assemble your system here from all the classes
            Door          door          = new Door(); //Der bruges metoder (open og close) der ikke er en del af interface
            IDisplay      display       = new Display(new ConsoleWriter());
            IUsbCharger   usb           = new UsbChargerSimulator();
            ChargeControl chargeControl = new ChargeControl(usb, display);
            ILogFile      logFile       = new LogFile(new TimeProvider(), new FileWriter());
            RfidReader    rfidReader    = new RfidReader();

            door = new Door();

            StationControl station = new StationControl(door, rfidReader, display, chargeControl, logFile);

            System.Console.WriteLine(
                "Velkommen til ladeskabet :) Her kan du få frisk strøm, mens din telefon er låst inde\n");
            do
            {
                string input;
                System.Console.WriteLine("Indtast bogstav: E_nd, O_pen, C_lose, R_rfid, P_lug eller U_nplug: ");
                input = Console.ReadLine();
                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }
                input = input.ToUpper();
                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();

                    rfidReader.ManualScanTag(idString);
                    break;

                case 'P':
                    chargeControl.PlugPhoneIn();
                    break;

                case 'U':
                    chargeControl.UnPlugPhone();
                    break;

                default:
                    break;
                }
            } while (!finish);
        }
예제 #2
0
 public void IsConnected_PluggedInPluggedOut_ReturnsFalse()
 {
     uut.PlugPhoneIn();
     uut.UnPlugPhone();
     Assert.That(uut.IsConnected, Is.EqualTo(false));
 }