Пример #1
0
        public void CircuitValidatesLooped()
        {
            // Later change to importing the circuit from file
            var c  = new Circuit();
            var i1 = new InputNode();

            var n1 = new NotNode();
            var n2 = new NotNode();
            var n3 = new NotNode();

            c.AddInput(i1, NodeCurrent.None);
            c.Add(i1);
            c.Add(n1);
            c.Add(n2);
            c.Add(n3);

            i1.AddOutput(n1);
            n1.AddOutput(n2);
            n2.AddOutput(n3);
            n3.AddOutput(n1);


            Assert.ThrowsException <CircuitInvalidException>(() =>
            {
                c.Accept(new CircuitLoopValidatorVisitor());
            });
        }