예제 #1
0
        public void GetDescriptionTest1()
        {
            Receptacle            target   = new Receptacle(name, interfaceName, isMultiple);
            ReceptacleDescription expected = new ReceptacleDescription(name, interfaceName, isMultiple, new ConnectionDescription[0]);
            ReceptacleDescription actual   = target.GetDescription();

            Assert.AreEqual(expected.name, actual.name);
            Assert.AreEqual(expected.interface_name, actual.interface_name);
            Assert.AreEqual(expected.is_multiplex, actual.is_multiplex);
        }
        /// <summary>
        /// Cria um vetor de <i>ReceptacleDescription</i> a partir de uma coleção de
        /// facetas.
        /// </summary>
        /// <param name="receptacles">A coleção de receptáculos.</param>
        /// <returns>O vetor de <i>ReceptacleDescription</i></returns>
        private ReceptacleDescription[] CreateReceptacleDescriptionVector(IDictionary <String, Receptacle> receptacles)
        {
            ReceptacleDescription[] receptacleDesc =
                new ReceptacleDescription[receptacles.Count];
            int counter = 0;

            foreach (Receptacle recep in receptacles.Values)
            {
                receptacleDesc[counter++] = new ReceptacleDescription(recep.Name,
                                                                      recep.InterfaceName, recep.IsMultiple,
                                                                      recep.GetConnections().ToArray());
            }
            return(receptacleDesc);
        }
예제 #3
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);
        }