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; } }
public void Run_CallsSocketConnectStartsTimerAndInitiatesCommunication() { // Arrange // Act _target.Run(); // Assert _mockUdpSocket.Verify(x => x.Connect()); _mockTimerFactory.Verify(x => x.CreateTimer()); VerifyPacketSent(); }