示例#1
0
    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);
    }
示例#2
0
 /* Testing: DoorOpen when locked/unlocked and event trigger */
 public void Test_OpenDoor_WhileLocked_DoorOpens()
 {
     door.LockDoor();
     door.OpenDoor();
     Assert.That(door.IsDoorOpen, Is.EqualTo(false));
 }