Exemplo n.º 1
0
        public void addElement()
        {
            ILogicalElement sourceElement = new Fakes.FakeElement();

            ILine line = new Line(sourceElement, 0);

            Fakes.FakeElement element = new Fakes.FakeElement();

            line.addConnection(element, 0);
            line.addConnection(element, 1);

            Assert.AreEqual(line.ElementsConnected, 1);

            PinsSet set = line.getConnections(element);

            Assert.AreEqual(set.Count, 2);
            Assert.IsTrue(set.Contains(0));
            Assert.IsTrue(set.Contains(1));
        }
Exemplo n.º 2
0
        /***************************************************************************/

        public void removeConnection(ILogicalElement _element, int _pin)
        {
            if (!hasConnection(_element))
            {
                throw new ArgumentException(
                          string.Format(Resoursers.Exceptions.Messages.noElementConnection, _element.ID));
            }

            PinsSet set = m_elements2Pins[_element];

            if (!set.Contains(_pin))
            {
                throw new ArgumentException(
                          string.Format(Resoursers.Exceptions.Messages.noPinConnection, _pin, _element.ID));
            }

            set.Remove(_pin);

            if (set.Count == 0)
            {
                m_elements2Pins.Remove(_element);
            }
        }