Ejemplo n.º 1
0
        public void GetConnectionsTest()
        {
            Receptacle target = new Receptacle(name, interfaceName, isMultiple);
            List <ConnectionDescription> expected = new List <ConnectionDescription>();
            List <ConnectionDescription> actual   = target.GetConnections();

            Assert.AreEqual(expected.Count, actual.Count);
            for (int i = 0; i < connections.Count; i++)
            {
                target.AddConnections(connections[i]);
            }

            actual = target.GetConnections();
            Assert.AreEqual(connections.Count, actual.Count);
        }
Ejemplo n.º 2
0
        public void ClearConnectionsTest()
        {
            Receptacle target = new Receptacle(name, interfaceName, isMultiple);
            List <int> idList = new List <int>(connections.Count);

            foreach (var connection in connections)
            {
                int id = target.AddConnections(connection);
                idList.Add(id);
            }
            List <ConnectionDescription> actual = target.GetConnections();

            Assert.AreEqual(connections.Count, actual.Count);

            target.ClearConnections();
            actual = target.GetConnections();
            Assert.AreEqual(0, actual.Count);
        }
Ejemplo n.º 3
0
        public void pong()
        {
            Console.WriteLine("[Executando o método pong no componente Pong]");
            Receptacle receptacle = context.GetReceptacles()["PongRec"];

            foreach (ConnectionDescription connection in receptacle.GetConnections())
            {
                PingPongServer pingPongServer = connection.objref as PingPongServer;
                pingPongServer.pong();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Obtém as conexões existentes no receptáculo.
        /// </summary>
        /// <param name="receptacle">O nome do receptáculo.</param>
        /// <returns>O conjunto de descritores de conexão.</returns>
        /// <exception cref="InvalidName">Caso um nome seja inválido.</exception>
        public ConnectionDescription[] getConnections(string receptacle)
        {
            IDictionary <string, Receptacle> receptacles = context.GetReceptacles();

            if (!receptacles.ContainsKey(receptacle))
            {
                throw new InvalidName {
                          name = receptacle
                }
            }
            ;

            Receptacle rec = receptacles[receptacle];

            return(rec.GetConnections().ToArray());
        }
Ejemplo n.º 5
0
        public void GetDescriptionTest2()
        {
            Receptacle target = new Receptacle(name, interfaceName, isMultiple);

            foreach (var connection in connections)
            {
                target.AddConnections(connection);
            }
            List <ConnectionDescription> receptacleConnectionsList = target.GetConnections();

            ConnectionDescription[] connectionDescription = receptacleConnectionsList.ToArray();
            ReceptacleDescription   expected = new ReceptacleDescription(name, interfaceName, isMultiple, connectionDescription);
            ReceptacleDescription   actual   = target.GetDescription();

            Assert.AreEqual(actual.name, expected.name);
            Assert.AreEqual(actual.interface_name, expected.interface_name);
            Assert.AreEqual(actual.is_multiplex, expected.is_multiplex);
            Assert.AreEqual(actual.connections.Length, expected.connections.Length);
        }