Exemplo n.º 1
0
        public void Simple()
        {
            using (var context = NetMQContext.Create())
            {
                using (NetMQActor actor = NetMQActor.Create(context, shim =>
                {
                    shim.SignalOK();

                    while (true)
                    {
                        NetMQMessage msg = shim.ReceiveMessage();

                        string command = msg[0].ConvertToString();

                        if (command == NetMQActor.EndShimMessage)
                        {
                            break;
                        }

                        else if (command == "Hello")
                        {
                            shim.Send("World");
                        }
                    }
                }))
                {
                    actor.SendMore("Hello");
                    actor.Send("Hello");
                    var result = actor.ReceiveString();
                    Assert.AreEqual("World", result);
                }
            }
        }