public void TestGetChiralAtom()
        {
            TetrahedralChirality chirality = new TetrahedralChirality(molecule.Atoms[1], ligands, TetrahedralStereo.Clockwise);

            Assert.IsNotNull(chirality);
            Assert.AreEqual(molecule.Atoms[1], chirality.ChiralAtom);
        }
        public void TestBuilder()
        {
            TetrahedralChirality chirality = new TetrahedralChirality(molecule.Atoms[1], ligands, TetrahedralStereo.Clockwise);

            chirality.Builder = ChemObjectBuilder.Instance;
            Assert.AreEqual(ChemObjectBuilder.Instance, chirality.Builder);
        }
        public void TestToString()
        {
            TetrahedralChirality chirality = new TetrahedralChirality(molecule.Atoms[1], ligands, TetrahedralStereo.Clockwise);
            string stringRepr = chirality.ToString();

            Assert.AreNotSame(0, stringRepr.Length);
            Assert.IsFalse(stringRepr.Contains("\n"));
        }
        public void TestGetLigands()
        {
            TetrahedralChirality chirality = new TetrahedralChirality(molecule.Atoms[1], ligands, TetrahedralStereo.Clockwise);

            Assert.IsNotNull(chirality);
            for (int i = 0; i < ligands.Length; i++)
            {
                Assert.AreEqual(ligands[i], chirality.Ligands[i]);
            }
        }
        public void TestMap_Map_Map()
        {
            IChemObjectBuilder builder = ChemObjectBuilder.Instance;

            IAtom c1 = builder.NewAtom("C");
            IAtom o2 = builder.NewAtom("O");
            IAtom n3 = builder.NewAtom("N");
            IAtom c4 = builder.NewAtom("C");
            IAtom h5 = builder.NewAtom("H");

            // new stereo element
            ITetrahedralChirality original = new TetrahedralChirality(c1, new IAtom[] { o2, n3, c4, h5 }, TetrahedralStereo.Clockwise);

            // clone the atoms and place in a map
            var   mapping = new CDKObjectMap();
            IAtom c1clone = (IAtom)c1.Clone();

            mapping.Set(c1, c1clone);
            IAtom o2clone = (IAtom)o2.Clone();

            mapping.Set(o2, o2clone);
            IAtom n3clone = (IAtom)n3.Clone();

            mapping.Set(n3, n3clone);
            IAtom c4clone = (IAtom)c4.Clone();

            mapping.Set(c4, c4clone);
            IAtom h5clone = (IAtom)h5.Clone();

            mapping.Set(h5, h5clone);

            // map the existing element a new element
            ITetrahedralChirality mapped = (ITetrahedralChirality)original.Clone(mapping);

            Assert.AreNotSame(original.ChiralAtom, mapped.ChiralAtom, "mapped chiral atom was the same as the original");
            Assert.AreSame(c1clone, mapped.ChiralAtom, "mapped chiral atom was not the clone");

            var originalLigands = original.Ligands;
            var mappedLigands   = mapped.Ligands;

            Assert.AreNotSame(originalLigands[0], mappedLigands[0], "first ligand was the same as the original");
            Assert.AreSame(o2clone, mappedLigands[0], "first mapped ligand was not the clone");
            Assert.AreNotSame(originalLigands[1], mappedLigands[1], "second ligand was the same as the original");
            Assert.AreSame(n3clone, mappedLigands[1], "second mapped ligand was not the clone");
            Assert.AreNotSame(originalLigands[2], mappedLigands[2], "third ligand was the same as the original");
            Assert.AreSame(c4clone, mappedLigands[2], "third mapped ligand was not the clone");
            Assert.AreNotSame(originalLigands[3], mappedLigands[3], "forth ligand was te same as the original");
            Assert.AreSame(h5clone, mappedLigands[3], "forth mapped ligand was not the clone");

            Assert.AreEqual(original.Stereo, mapped.Stereo, "stereo was not mapped");
        }
        public void TestMap_Null_Map()
        {
            IChemObjectBuilder builder = ChemObjectBuilder.Instance;

            IAtom c1 = builder.NewAtom("C");
            IAtom o2 = builder.NewAtom("O");
            IAtom n3 = builder.NewAtom("N");
            IAtom c4 = builder.NewAtom("C");
            IAtom h5 = builder.NewAtom("H");

            // new stereo element
            ITetrahedralChirality original = new TetrahedralChirality(c1, new IAtom[] { o2, n3, c4, h5 }, TetrahedralStereo.Clockwise);

            // map the existing element a new element
            ITetrahedralChirality mapped = (ITetrahedralChirality)original.Clone(null);
        }
        public void TestMap_Map_Map_EmptyMapping()
        {
            IChemObjectBuilder builder = ChemObjectBuilder.Instance;

            IAtom c1 = builder.NewAtom("C");
            IAtom o2 = builder.NewAtom("O");
            IAtom n3 = builder.NewAtom("N");
            IAtom c4 = builder.NewAtom("C");
            IAtom h5 = builder.NewAtom("H");

            // new stereo element
            ITetrahedralChirality original = new TetrahedralChirality(c1, new IAtom[] { o2, n3, c4, h5 }, TetrahedralStereo.Clockwise);

            // map the existing element a new element - should through an IllegalArgumentException
            var map = new CDKObjectMap();
            ITetrahedralChirality mapped = (ITetrahedralChirality)original.Clone(map);

            Assert.AreSame(original.ChiralAtom, mapped.ChiralAtom);
        }
        public void Contains()
        {
            IChemObjectBuilder builder = ChemObjectBuilder.Instance;

            IAtom c1 = builder.NewAtom("C");
            IAtom o2 = builder.NewAtom("O");
            IAtom n3 = builder.NewAtom("N");
            IAtom c4 = builder.NewAtom("C");
            IAtom h5 = builder.NewAtom("H");

            // new stereo element
            ITetrahedralChirality element = new TetrahedralChirality(c1, new IAtom[] { o2, n3, c4, h5 }, TetrahedralStereo.Clockwise);

            Assert.IsTrue(element.Contains(c1));
            Assert.IsTrue(element.Contains(o2));
            Assert.IsTrue(element.Contains(n3));
            Assert.IsTrue(element.Contains(c4));
            Assert.IsTrue(element.Contains(h5));

            Assert.IsFalse(element.Contains(builder.NewAtom()));
            Assert.IsFalse(element.Contains(null));
        }
        public void TestTetrahedralChirality_IAtom_arrayIAtom_ITetrahedralChirality_Stereo()
        {
            TetrahedralChirality chirality = new TetrahedralChirality(molecule.Atoms[1], ligands, TetrahedralStereo.Clockwise);

            Assert.IsNotNull(chirality);
        }