public void TestSynchronous() { Instruction <string, string> invokePing = (ct, rp, arg) => { var mainWindow = AutomationElement.RootElement.WaitForFirstChild(arg); var pingButton = mainWindow.WaitForFirstChild("Ping"); pingButton.Invoke(); return("Pinged"); }; Instruction <string, Tuple <string, string> > invokePong = (ct, rp, arg) => { var mainWindow = AutomationElement.RootElement.WaitForFirstChild("PongApp"); var pongButton = mainWindow.WaitForFirstChild("Pong"); pongButton.Invoke(); return(new Tuple <string, string>(arg, "Ponged")); }; for (int i = 0; i < 2; i++) { var result = Coordinator.Do(_onWorkerOne.Do(invokePing), "PingApp").ThenDo(_onWorkerTwo.Do(invokePong)).ResultValue; var expectedResult = new Tuple <string, string>("Pinged", "Ponged"); Assert.AreEqual(result, expectedResult); } }
public void FixtureSetUp() { _onWorkerOneProcess = Start(GetPathFromConfig("PingApp-worker-exe-file"), WorkerService); _onWorkerTwoProcess = Start(GetPathFromConfig("PongApp-worker-exe-file"), WorkerService); var _pingCallBackHandler = new ExecutorCallbackService(); var _pongCallBackHandler = new ExecutorCallbackService(); _onWorkerOne = OnWorker.FromEndpointConfigNames("PingApp-AssemblyManager", "PingApp-Executor", _pingCallBackHandler); _onWorkerTwo = OnWorker.FromEndpointConfigNames("PongApp-AssemblyManager", "PongApp-Executor", _pongCallBackHandler); Instruction <Tuple <string, string>, bool> openApp1 = (ct, rp, args) => OpenApp(ct, rp, args.Item1); Instruction <Tuple <string, string>, bool> openApp2 = (ct, rp, args) => OpenApp(ct, rp, args.Item2); pingPath = GetPathFromConfig("PingApp-exe-file"); pongPath = GetPathFromConfig("PongApp-exe-file"); var tuple = new Tuple <string, string>(pingPath + @"\PingApp.exe", pongPath + @"\PongApp.exe"); DistrEx.Coordinator.Coordinator.Do(_onWorkerOne.Do(openApp1), _onWorkerTwo.Do(openApp2), tuple); }