Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
        public void DoorLockedSimulated()
        {
            _uut.LockDoor();
            var text = _stringWriter.ToString();

            Assert.AreEqual("**Dør låst**\r\n", text);
        }
Ejemplo n.º 3
0
        public void DoorStatus_IsClosedAndLocked_DoorIsLockedIsTrue()
        {
            //act
            uut.LockDoor();

            //Assert

            Assert.Multiple(() =>
            {
                Assert.That(uut.DoorIsLocked, Is.True);
                Assert.That(uut.DoorIsOpen, Is.False);
            });
        }
Ejemplo n.º 4
0
 public void LockDoor_LockDoorCalled_LockedTrue()
 {
     _uut.LockDoor();
     Assert.That(_uut.Locked, Is.EqualTo(true));
 }
Ejemplo n.º 5
0
 public void LockDoor_IsLocked_IsTrue()
 {
     _uut.LockDoor();
     Assert.That(_uut.IsLocked, Is.True);
 }
Ejemplo n.º 6
0
 public void LockDoor_ChangesState_EventFired()
 {
     _uut.UnlockDoor();
     _uut.LockDoor();
     Assert.That(_receivedEventArgsClosed, Is.Not.Null);
 }
Ejemplo n.º 7
0
        public void TestingLockDoor()
        {
            _uut.LockDoor();

            Assert.That(_uut.Islocked, Is.EqualTo(true));
        }
Ejemplo n.º 8
0
 public void LockingSetsStateToLocked()
 {
     _door.LockDoor();
     Assert.That(_door.IsLocked, Is.True);
 }
Ejemplo n.º 9
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));
 }