コード例 #1
0
        public void Connect()
        {
            try
            {
                DisposeWorkersAndTimer();

                ControlWorker = WorkerFactory.CreateControlWorker();
                ControlWorker.Disconnected += ControlSocketOnDisconnected;

                CommandWorker = WorkerFactory.CreateCommandWorker();

                NavDataWorker = WorkerFactory.CreateNavDataWorker();
                NavDataWorker.NavDataReceived += NavDataWorkerOnNavDataReceived;

                ControlWorker.Run();
                CommandWorker.Run();

                CommandTimer = TimerFactory.CreateTimer();

                NavDataWorker.Run();

                QueueInitialCommands();

                Connected = true;
            }
            catch
            {
                Disconnect();
                throw;
            }
        }
コード例 #2
0
        public void Run_CallsSocketConnectStartsTimerAndInitiatesCommunication()
        {
            // Arrange

            // Act
            _target.Run();

            // Assert
            _mockUdpSocket.Verify(x => x.Connect());
            _mockTimerFactory.Verify(x => x.CreateTimer());
            VerifyPacketSent();
        }