private InputPacketsAnalyser CreateAnalyser(RemoteKeyboard keyboard) { var analyser = new InputPacketsAnalyser(); analyser.SetActiveKeyboard(keyboard); return analyser; }
private void RunTestCodeWithServerAndClientConnection(TestCodeDelegate deleg) { var mouse = new RemoteMouse(); var touch = new RemoteTouch(); var keyboard = new RemoteKeyboard(); var analyser = new InputPacketsAnalyser(); analyser.SetActiveMouse(mouse); analyser.SetActiveTouch(touch); analyser.SetActiveKeyboard(keyboard); var server = new RemoteServer(analyser, TestPort); RemoteClient client = CreateTestClient(); Task connection = client.ConnectToServerAsync(); connection.Wait(); var data = new TestObjects { Client = client, Mouse = mouse, Touch = touch, Keyboard = keyboard }; server.Received += delegate { data.NumberOfReceivedMessages++; }; try { if (deleg != null) deleg(data); } catch (Exception ex) { Assert.Fail(ex.ToString()); } finally { client.Dispose(); server.Dispose(); } }