Пример #1
0
        public void NoBuilder()
        {
            IAtom focus = new Mock <IAtom>().Object;

            IAtom[]             peripherals = new IAtom[] { new Mock <IAtom>().Object, new Mock <IAtom>().Object, new Mock <IAtom>().Object, new Mock <IAtom>().Object };
            ExtendedTetrahedral element     = new ExtendedTetrahedral(focus, peripherals, TetrahedralStereo.Clockwise);
            var dummy = element.Builder;
        }
Пример #2
0
        public void NonCumulatedAtomThrowsException()
        {
            var ac = new AtomContainer();

            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("C"));
            ac.AddBond(ac.Atoms[0], ac.Atoms[1], BondOrder.Single);
            ac.AddBond(ac.Atoms[1], ac.Atoms[2], BondOrder.Single);
            ExtendedTetrahedral.FindTerminalAtoms(ac, ac.Atoms[0]);
        }
Пример #3
0
        public void TerminalAtomsAreFoundUnordered()
        {
            var ac = new AtomContainer();

            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("C"));
            ac.AddBond(ac.Atoms[0], ac.Atoms[1], BondOrder.Double);
            ac.AddBond(ac.Atoms[1], ac.Atoms[2], BondOrder.Double);
            IAtom[] terminals = ExtendedTetrahedral.FindTerminalAtoms(ac, ac.Atoms[1]);
            // note order may change
            Assert.AreEqual(ac.Atoms[0], terminals[0]);
            Assert.AreEqual(ac.Atoms[2], terminals[1]);
        }
Пример #4
0
        public void PeripheralsAreCopied()
        {
            IAtom focus = new Mock <IAtom>().Object;

            IAtom[]             peripherals = new IAtom[] { new Mock <IAtom>().Object, new Mock <IAtom>().Object, new Mock <IAtom>().Object, new Mock <IAtom>().Object };
            ExtendedTetrahedral element     = new ExtendedTetrahedral(focus, peripherals, TetrahedralStereo.Clockwise);

            // modifying this array does not change the one in the structure
            peripherals[0] = peripherals[1] = peripherals[2] = peripherals[3] = null;
            Assert.IsNotNull(element.Peripherals[0]);
            Assert.IsNotNull(element.Peripherals[1]);
            Assert.IsNotNull(element.Peripherals[2]);
            Assert.IsNotNull(element.Peripherals[3]);
        }
Пример #5
0
        public void ContainsAnAtom()
        {
            IAtom focus = new Mock <IAtom>().Object;

            IAtom[]             peripherals = new IAtom[] { new Mock <IAtom>().Object, new Mock <IAtom>().Object, new Mock <IAtom>().Object, new Mock <IAtom>().Object };
            ExtendedTetrahedral element     = new ExtendedTetrahedral(focus, peripherals, TetrahedralStereo.Clockwise);

            Assert.IsTrue(element.Contains(focus));
            Assert.IsTrue(element.Contains(peripherals[0]));
            Assert.IsTrue(element.Contains(peripherals[1]));
            Assert.IsTrue(element.Contains(peripherals[2]));
            Assert.IsTrue(element.Contains(peripherals[3]));

            Assert.IsFalse(element.Contains(new Mock <IAtom>().Object));
        }
Пример #6
0
        public void TerminalAtomsAreFoundOrdered()
        {
            var ac = new AtomContainer();

            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("C"));
            ac.Atoms.Add(new Atom("C"));
            ac.AddBond(ac.Atoms[0], ac.Atoms[1], BondOrder.Single);
            ac.AddBond(ac.Atoms[1], ac.Atoms[2], BondOrder.Double);
            ac.AddBond(ac.Atoms[2], ac.Atoms[3], BondOrder.Double);
            ac.AddBond(ac.Atoms[3], ac.Atoms[4], BondOrder.Single);

            ExtendedTetrahedral element = new ExtendedTetrahedral(ac.Atoms[2], new IAtom[] { ac.Atoms[4], ac.Atoms[3],
                                                                                             ac.Atoms[1], ac.Atoms[0] }, TetrahedralStereo.Clockwise);

            IAtom[] terminals = element.FindTerminalAtoms(ac);
            Assert.AreEqual(ac.Atoms[3], terminals[0]);
            Assert.AreEqual(ac.Atoms[1], terminals[1]);
        }