Example #1
0
        public void StationControl_RFIDDetected_CurrentIntIsCorrect(int idChanged)
        {
            //Arrange
            var _display       = Substitute.For <IDisplay>();
            var _door          = Substitute.For <IDoor>();
            var _charger       = Substitute.For <ICharger>();
            var _rfid          = Substitute.For <IRFIDReader>();
            var _chargeControl = new ChargeControl(_charger, _display);

            _uut = new StationControl(_rfid, _display, _door, _chargeControl);
            //Sætter state til at være available
            _door.DoorChangedEvent += Raise.EventWith(new DoorEventArgs {
                OpenDoor = false
            });
            _door.DoorChangedEvent += _uut.DoorClosed;

            //Act
            _charger.Connected = true;
            _rfid.RFIDEvent   += Raise.EventWith(new RFIDEventArgs {
                RFID = idChanged
            });
            _rfid.RFIDEvent += _uut.RfidDetected;

            //Assert
            Assert.That(_uut._oldId, Is.EqualTo(idChanged));
        }
Example #2
0
        static void Main(string[] args)
        {
            IDoor         _door          = new Door();
            IRFIDReader   _rfidReader    = new RFIDReader();
            Display       _display       = new Display();
            Logfile       _logfile       = new Logfile();
            IUsbCharger   _usbCharger    = new UsbChargerSimulator();
            ChargeControl _chargeControl = new ChargeControl(_usbCharger, _display);

            StationControl _stationControl = new StationControl(_rfidReader, _door, _display, _logfile, _chargeControl);

            //        _door.OnUserOpensDoor();

            _door.OnUserOpensDoor();
            Thread.Sleep(2000);
            _door.OnUserClosesDoor();
            Thread.Sleep(2000);
            _rfidReader.OnRFIDTagPresented(123);
            Thread.Sleep(1000);
            Console.WriteLine("...");
            Thread.Sleep(1000);
            Console.WriteLine("...");
            Thread.Sleep(1000);
            Console.WriteLine("...");

            Thread.Sleep(2000);
            _rfidReader.OnRFIDTagPresented(123);
            Console.ReadKey();
        }
Example #3
0
        public void Setup()
        {
            //Creating stubs for dependencies
            stubdoor       = Substitute.For <IDoor>();
            stubCharger    = Substitute.For <IChargeControl>();
            stubDisplay    = Substitute.For <IDisplay>();
            stubRFIDReader = Substitute.For <IRFIDReader>();
            stubUsb        = Substitute.For <IUsbCharger>();

            //Initialising classes for tests
            usb            = new UsbChargerSimulator();
            rfidReader     = new RFIDReader();
            display        = new ConcreteDisplay();
            door           = new Door();
            chargeControl  = new ChargeControl(stubUsb);
            stationControl = new StationControl(stubCharger, stubdoor, stubDisplay, stubRFIDReader);

            _rfidEventArgs = null;
            rfidReader.RFIDDetectedEvent += (o, args) => { _rfidEventArgs = args; };

            _doorEventArgs  = null;
            door.DoorEvent += (o, args) => { _doorEventArgs = args; };

            _currentEventArgs      = null;
            usb.CurrentValueEvent += (o, args) => { _currentEventArgs = args; };
        }
Example #4
0
        public void Setup()
        {
            _display    = Substitute.For <IDisplay>();
            _usbCharger = Substitute.For <IUsbCharger>();

            _uut = new ChargeControl(_display, _usbCharger);
        }
Example #5
0
        public void SetUp()
        {
            _usbCharger = Substitute.For <IUsbCharger>();
            _display    = Substitute.For <IDisplay>();

            _uut = new ChargeControl(_usbCharger, _display);
        }
Example #6
0
        public void StationControl_RfidDetectedStateAvailableAndChargerConnected_LockDoor()
        {
            //Arrange
            var _display       = Substitute.For <IDisplay>();
            var _door          = Substitute.For <IDoor>();
            var _charger       = Substitute.For <ICharger>();
            var _rfid          = Substitute.For <IRFIDReader>();
            var _chargeControl = new ChargeControl(_charger, _display);

            _uut = new StationControl(_rfid, _display, _door, _chargeControl);
            //Sætter state til at være available
            _door.DoorChangedEvent += Raise.EventWith(new DoorEventArgs {
                OpenDoor = false
            });
            _door.DoorChangedEvent += _uut.DoorClosed;

            //Act
            _charger.Connected = true;
            _rfid.RFIDEvent   += Raise.EventWith(new RFIDEventArgs {
                RFID = rfid
            });
            _rfid.RFIDEvent += _uut.RfidDetected;

            //Assert
            _door.Received().LockDoor();
        }
Example #7
0
        public void StationControl_RfidDetectedStateLockedAndOldidNotEqualRFID_RFIDFail()
        {
            //Arrange
            var _display       = Substitute.For <IDisplay>();
            var _door          = Substitute.For <IDoor>();
            var _charger       = Substitute.For <ICharger>();
            var _rfid          = Substitute.For <IRFIDReader>();
            var _chargeControl = new ChargeControl(_charger, _display);

            _uut = new StationControl(_rfid, _display, _door, _chargeControl);
            //Sætter state til at være Locked
            _door.DoorChangedEvent += Raise.EventWith(new DoorEventArgs {
                OpenDoor = false
            });
            _door.DoorChangedEvent += _uut.DoorClosed;
            _charger.Connected      = true;
            _rfid.RFIDEvent        += Raise.EventWith(new RFIDEventArgs {
                RFID = _uut._oldId
            });
            _rfid.RFIDEvent += _uut.RfidDetected;

            //Act
            _uut._oldId      = 123;
            _rfid.RFIDEvent += Raise.EventWith(new RFIDEventArgs {
                RFID = 456
            });
            _rfid.RFIDEvent += _uut.RfidDetected;

            //Assert
            _display.Received().RFIDFail();
        }
Example #8
0
        public void StationControl_RfidDetectedStateLockedAndOldidEqualsRFID_WriteToLog()
        {
            //Arrange
            var _display       = Substitute.For <IDisplay>();
            var _door          = Substitute.For <IDoor>();
            var _charger       = Substitute.For <ICharger>();
            var _log           = Substitute.For <ILogFile>();
            var _rfid          = Substitute.For <IRFIDReader>();
            var _chargeControl = new ChargeControl(_charger, _display);

            _uut          = new StationControl(_rfid, _display, _door, _chargeControl);
            _uut._logfile = _log;
            //Sætter state til at være Locked
            _door.DoorChangedEvent += Raise.EventWith(new DoorEventArgs {
                OpenDoor = false
            });
            _door.DoorChangedEvent += _uut.DoorClosed;
            _charger.Connected      = true;
            _rfid.RFIDEvent        += Raise.EventWith(new RFIDEventArgs {
                RFID = _uut._oldId
            });
            _rfid.RFIDEvent += _uut.RfidDetected;

            //Act
            _rfid.RFIDEvent += Raise.EventWith(new RFIDEventArgs {
                RFID = _uut._oldId
            });
            _rfid.RFIDEvent += _uut.RfidDetected;

            //Assert
            _log.Received().WriteToLogUnlocked(_uut._oldId);
        }
Example #9
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);
    }
Example #10
0
        public void Setup()
        {
            display    = Substitute.For <IDisplay>();
            usbCharger = Substitute.For <IUsbCharger>();

            uut = new ChargeControl(display, usbCharger);
        }
        public void Setup()
        {
            // Common Arrange:
            _stubDisplay    = Substitute.For <IDisplay>();
            _mockUsbCharger = Substitute.For <IUsbCharger>();

            _uut = new ChargeControl(_stubDisplay, _mockUsbCharger);
        }
Example #12
0
        public void Setup()
        {
            _usbCharger = Substitute.For <IUsbCharger>();    //Lavet fake af UsbChargerSimulator.
            _display    = Substitute.For <IDisplay>();       //Lavet fake af Display.

            _uut = new ChargeControl(_usbCharger, _display); //ChargeControl skal have en usbCharger og et Display.
            //_uut.CurrentCurrent = 0.0;
        }
Example #13
0
        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()
            {
                _chargeDisplayArgs = null;

                _usbCharger = Substitute.For <IUsbCharger>();
                _uut        = new ChargeControl(_usbCharger);

                _uut.ChargeDisplayEvent += (o, args) => { _chargeDisplayArgs = args; };
            }
Example #15
0
        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);
        }
Example #16
0
        static void Main(string[] args)
        {
            // Assemble your system here from all the classes
            IIdReader      rfidReader = new RfidReader();
            IDoor          door       = new Door();
            IUsbCharger    usbCharger = new UsbChargerSimulator();
            IChargeControl charger    = new ChargeControl(usbCharger);
            StationControl control    = new StationControl(rfidReader, door, charger, new FileLogger());

            bool finish = false;

            do
            {
                string input;
                System.Console.WriteLine("Valgmuligheder:");
                System.Console.WriteLine("E: End");
                System.Console.WriteLine("O: Open door");
                System.Console.WriteLine("C: Close door");
                System.Console.WriteLine("R: Id Reader");
                input = Console.ReadLine();
                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }

                switch (input[0])
                {
                case 'E':
                    finish = true;
                    break;

                case 'O':
                    door.OpenDoor();
                    break;

                case 'T':
                    usbCharger.Connected = true;
                    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.ReadId(id);
                    break;

                default:
                    break;
                }
            } while (!finish);
        }
Example #17
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);
    }
        public void startCharge_methodIsCalled_UsbSimulatorStartChargeIsCalled()
        {
            IUsbCharger _usbCharger = Substitute.For <IUsbCharger>();

            var uut = new ChargeControl(_usbCharger, new Display());

            uut.StartCharge();

            _usbCharger.Received().StartCharge();
        }
        public void Setup()
        {
            _displaySimulator    = Substitute.For <IDisplaySimulator>();
            _usbCharger          = Substitute.For <IUsbCharger>();
            _rfidReaderSimulator = Substitute.For <IRfidReaderSimulator>();
            _uut = new ChargeControl(_displaySimulator, _usbCharger);

            _output = new StringWriter();
            System.Console.SetOut(_output);
        }
Example #20
0
        public void Setup()
        {
            usbCharger = Substitute.For <IUsbCharger>();
            display    = Substitute.For <IDisplay>();

            _uut = new ChargeControl(usbCharger, display);
            _uut.ChargerConnectionValueEvent += (sender, args) =>
            {
                ChargerConnectionValueEventRaised = true;
            };
        }
        public void Setup()
        {
            _display       = Substitute.For <IDisplay>();
            _door          = Substitute.For <IDoor>();
            _fileLog       = Substitute.For <IFileLog>();
            _rfidReader    = Substitute.For <IRfidReader>();
            _usbCharger    = Substitute.For <IUsbCharger>();
            _chargeControl = Substitute.For <ChargeControl>(_usbCharger, _display);

            _uut = new StationControl(_door, _rfidReader, _chargeControl, _fileLog, _display);
        }
Example #22
0
        public void Setup()
        {
            _display = Substitute.For <IDisplay>();
            _charger = Substitute.For <IUsbCharger>();

            _uut = new ChargeControl(_display, _charger);

            //Fake eventhandler
            //_uut.CurrentChangedEvent +=
            //    (
            //    );
        }
Example #23
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.Write("Test");
            var      door              = new Door();
            var      rfidReader        = new RFIDReader();
            IDisplay display           = new Display();
            var      usbCharger        = new USBCharger();
            var      chargeController  = new ChargeControl(usbCharger, display);
            var      stationController = new StationControl(rfidReader, display, door, chargeController);

            // Assemble your system here from all the classes

            bool finish = false;

            do
            {
                string input;
                System.Console.WriteLine("Indtast E for exit, O for open, C for close, R for rfid read: ");
                input = Console.ReadLine();
                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }

                switch (input[0])
                {
                case 'E':
                    finish = true;
                    break;

                case 'O':
                    door.OpenCloseDoor(true);
                    break;

                case 'C':
                    door.OpenCloseDoor(false);
                    break;

                case 'R':
                    System.Console.WriteLine("Indtast RFID id: ");
                    string idString = System.Console.ReadLine();

                    int id = Convert.ToInt32(idString);
                    rfidReader.ReadRFID(id);

                    break;

                default:
                    break;
                }
            } while (!finish);
        }
Example #24
0
        static void Main(string[] args)
        {
            MyConsole           myConsole     = new MyConsole();
            HdDisplay           display       = new HdDisplay(myConsole);
            UsbChargerSimulator usbCharger    = new UsbChargerSimulator();
            ChargeControl       chargeControl = new ChargeControl(usbCharger, display);
            Door        door       = new Door();
            TextLogger  textLogger = new TextLogger();
            LogFile     logFile    = new LogFile(textLogger);
            RfidScanner scanner    = new RfidScanner();

            StationControl stationControl = new StationControl(chargeControl, door, scanner, display, logFile);

            bool finish = false;

            do
            {
                string input;
                System.Console.WriteLine("E: Exit \nO: Open\nC: Close\nS: Scan RFID");
                System.Console.WriteLine("Enter: E, O, C, S: ");
                input = Console.ReadLine().ToUpper();
                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }

                switch (input[0])
                {
                case 'E':
                    finish = true;
                    break;

                case 'O':
                    door.DoorOpen();
                    break;

                case 'C':
                    door.DoorClose();
                    break;

                case 'S':
                    System.Console.WriteLine("Enter RFID: ");
                    string idString = System.Console.ReadLine();

                    int id = Convert.ToInt32(idString);
                    scanner.ScanId(id);
                    break;

                default:
                    break;
                }
            } while (!finish);
        }
Example #25
0
    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);
    }
        static void Main(string[] args)
        {
            ConsoleWriter       writer        = new ConsoleWriter();
            Display             display       = new Display(writer);
            TimeProvider        time          = new TimeProvider();
            FileWriter          file          = new FileWriter();
            LogFile             logfile       = new LogFile(file, time);
            RfidReader          rfid          = new RfidReader();
            Door                door          = new Door();
            UsbChargerSimulator usbCharger    = new UsbChargerSimulator();
            ChargeControl       chargeControl = new ChargeControl(display, usbCharger);
            StationControl      station       = new StationControl(chargeControl, door, rfid, display, logfile);

            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);
                    rfid.OnRfidRead(id);
                    break;

                default:
                    break;
                }
            } while (!finish);
        }
        public void UpdateCurrentCalue_Values_chargeMessage(string message, double CurrentValue)
        {
            _chargerUsb = Substitute.For <IUsbCharger>();
            _display    = Substitute.For <IDisplay>();

            ChargeControl uut = new ChargeControl(_chargerUsb, _display);

            _chargerUsb.CurrentValueEvent += Raise.EventWith(new CurrentEventArgs {
                Current = CurrentValue
            });

            StringAssert.Contains(message, uut._chargeMessage);
        }
        public void UpdateCurrentValue_Overload_StopChargeCalled()
        {
            int overloadCurrent = 750;

            _chargerUsb = Substitute.For <IUsbCharger>();
            _display    = Substitute.For <IDisplay>();

            ChargeControl uut = new ChargeControl(_chargerUsb, _display);

            uut.UpdateCurrentCalue(overloadCurrent);

            _chargerUsb.Received().StopCharge();
        }
Example #29
0
        static void Main(string[] args)
        {
            // Assemble your system here from all the classes


            IDoor          door       = new Door();
            IDisplay       display    = new Display();
            IUsbCharger    usbCharger = new UsbChargerSimulator();
            IRfidReader    rfidReader = new RfidReader();
            IChargeControl charge     = new ChargeControl(usbCharger);

            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: ");
                    string idString = System.Console.ReadLine();

                    int id = Convert.ToInt32(idString);
                    rfidReader.SetRfidTag(id);

                    break;

                default:
                    break;
                }
            } while (!finish);
        }
Example #30
0
    static void Main(string[] args)
    {
        // Assemble your system here from all the classes
        IRFIDReader    _rfidReader     = new RFIDReader();
        IDoor          _door           = new Door();
        IDisplay       _display        = new Display();
        ILog           _log            = new LogToFile();
        IUsbCharger    _usbCharger     = new UsbChargerSimulator();
        IChargeControl _chargeControl  = new ChargeControl(_usbCharger, _display);
        StationControl _stationControl = new StationControl(_door, _rfidReader, _display, _chargeControl, _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.OpenDoor();
                break;

            case 'C':
                _door.CloseDoor();
                break;

            case 'R':
                System.Console.WriteLine("Indtast RFID id: ");
                string id = System.Console.ReadLine();
                _rfidReader.Read(id);
                break;

            default:
                break;
            }
        } while (!finish);
    }