Exemplo n.º 1
0
        public void AgentSupplyGpiTest()
        {
            IGpiA retGpiA = null;

            Regulus.Serialization.ISerializer serializer = new Regulus.Serialization.Dynamic.Serializer();
            IProtocol protocol = ProtocolHelper.CreateProtocol(serializer);

            Stream cdClient = new Regulus.Remote.Standalone.Stream();

            Network.IStreamable             peerClient = cdClient;
            PackageWriter <ResponsePackage> writer     = new PackageWriter <ResponsePackage>(serializer);

            writer.Start(new ReverseStream(cdClient));

            Ghost.IAgent agent = new Regulus.Remote.Ghost.Agent(protocol) as Ghost.IAgent;
            agent.QueryNotifier <IGpiA>().Supply += gpi => retGpiA = gpi;
            agent.Start(peerClient);

            writer.ServerToClient(serializer, ServerToClientOpCode.LoadSoul, new Regulus.Remote.PackageLoadSoul()
            {
                EntityId = 1, ReturnType = false, TypeId = 1
            });
            writer.ServerToClient(serializer, ServerToClientOpCode.LoadSoulCompile, new Regulus.Remote.PackageLoadSoulCompile()
            {
                EntityId = 1, TypeId = 1, ReturnId = 0, PassageId = 0
            });
            while (retGpiA == null)
            {
                agent.Update();
            }
            agent.Stop();
            writer.Stop();
            Assert.AreNotEqual(null, retGpiA);
        }