public void Run() { var config = new FlowRuntimeConfiguration() .AddEventBasedComponent("Op", new Op()) .AddStream(".receive@op", "op.receive") .AddStream("op.send", ".send@op"); using (var fr = new FlowRuntime(config, new Schedule_for_sync_depthfirst_processing())) { fr.Message += Console.WriteLine; var sut = new HostTranslator(); sut.Translated_input += fr.Process; fr.Result += sut.Process_local_output; Tuple <string, HostOutput> result = null; sut.Translated_output += _ => result = _; var input = new HostInput { CorrelationId = Guid.NewGuid(), Data = "hello".Serialize(), Portname = "op.receive", StandInEndpointAddress = "localhost:1234" }; sut.Process_remote_input(input); Assert.AreEqual("localhost:1234", result.Item1); Assert.AreEqual(input.CorrelationId, result.Item2.CorrelationId); Assert.AreEqual("<hello>".Serialize(), result.Item2.Data); Assert.AreEqual("op.send", result.Item2.Portname); } }
public OperationHost(IFlowRuntime runtime, IHostStub hostStub, IStandInProxy standInProxy) { _hostStub = hostStub; _standInProxy = standInProxy; _translator = new HostTranslator(); hostStub.ReceivedFromStandIn += _translator.Process_remote_input; _translator.Translated_input += runtime.Process; runtime.Result += _translator.Process_local_output; _translator.Translated_output += standInProxy.SendToStandIn; }