public void ReactorParseTest()
        {
            var reactor = Reactor.Parse("reactors\\simple1.json");

            Assert.AreEqual(10, reactor.Width);
            Assert.AreEqual(8, reactor.Height);
            Assert.AreEqual(reactor.AlphaStart.x, 5);
            Assert.AreEqual(reactor.AlphaStart.y, 5);
            Assert.AreEqual(reactor.AlphaStart.direction, Direction.Left);
            Assert.AreEqual(reactor.BetaStart.x, 5);
            Assert.AreEqual(reactor.BetaStart.y, 6);
            Assert.AreEqual(reactor.BetaStart.direction, Direction.Up);

            var tile = reactor.GetTileAttributes(0, 3);

            Assert.AreEqual(Instruction.Grab, tile.instructionBeta);

            tile = reactor.GetTileAttributes(6, 6);
            Assert.AreEqual(Instruction.Empty, tile.instructionAlpha);
            Assert.AreEqual(Instruction.Empty, tile.instructionBeta);
            Assert.AreEqual(Direction.Continue, tile.directionAlpha);
            Assert.AreEqual(Direction.Continue, tile.directionBeta);

            var atom1 = new Atom(2, 2, "hydrogen");
            var atom2 = new Atom(2, 3, "oxygen");

            atom1.AddBond(atom2);

            var input = reactor.AlphaInput.Generate();

            Assert.IsTrue(input.Molecule.Equals(atom1.Molecule));
        }
Exemplo n.º 2
0
        public void ConnectedAtomsTest()
        {
            var atom1 = new Atom(2, 2, "hydrogen");
            var atom2 = new Atom(2, 3, "oxygen");
            var atom3 = new Atom(2, 1, "nitrogen");

            atom1.AddBond(atom2);
            atom1.AddBond(atom3);
            var m1 = atom1.Molecule;

            var atom4 = new Atom(2, 2, "hydrogen");
            var atom5 = new Atom(2, 1, "oxygen");
            var atom6 = new Atom(2, 3, "nitrogen");

            atom5.AddBond(atom4);
            atom4.AddBond(atom6);
            var m2 = atom4.Molecule;
            var m3 = atom5.Molecule;

            Assert.IsTrue(m1.Equals(m2));
            Assert.IsTrue(m1.Equals(m3));
            Assert.IsTrue(m2.Equals(m3));
        }