Ejemplo n.º 1
0
        public void TestReturnsNull()
        {
            IAtom hydrogen = new ImmutableHydrogen();

            Assert.IsNull(hydrogen.Charge);
            Assert.IsNull(hydrogen.ImplicitHydrogenCount);
            Assert.IsNull(hydrogen.Point2D);
            Assert.IsNull(hydrogen.Point3D);
            Assert.AreEqual(0, hydrogen.StereoParity);
            Assert.IsNull(hydrogen.AtomTypeName);
            Assert.IsNull(hydrogen.BondOrderSum);
            Assert.IsNull(hydrogen.CovalentRadius);
            Assert.IsNull(hydrogen.FormalCharge);
            Assert.IsNull(hydrogen.FormalNeighbourCount);
            Assert.AreEqual((Hybridization)0, hydrogen.Hybridization);
            Assert.AreEqual((BondOrder)0, hydrogen.MaxBondOrder);
            Assert.IsNull(hydrogen.Valency);
            Assert.IsNull(hydrogen.ExactMass);
            Assert.IsNull(hydrogen.Abundance);
            Assert.IsFalse(hydrogen.IsAromatic);
            Assert.IsFalse(hydrogen.IsVisited);
            Assert.IsFalse(hydrogen.IsPlaced);
            Assert.IsNull(hydrogen.Id);
            Assert.IsNull(hydrogen.GetProperties());
            Assert.IsNull(hydrogen.GetProperty <string>(""));
            Assert.IsNull(hydrogen.Builder);
        }
Ejemplo n.º 2
0
        public void TestSetIsSilent()
        {
            // because we already test that the matching get methods
            // return null, we only test that set does not throw
            // exceptions
            IAtom hydrogen = new ImmutableHydrogen
            {
                Charge = 2.0,
                ImplicitHydrogenCount = 1,
                Point2D              = new Vector2(1, 2),
                Point3D              = new Vector3(2, 3, 4),
                StereoParity         = 1,
                AtomTypeName         = "foo",
                BondOrderSum         = 4.0,
                CovalentRadius       = 1.4,
                FormalCharge         = 1,
                FormalNeighbourCount = 2,
                Hybridization        = Hybridization.Planar3,
                MaxBondOrder         = BondOrder.Quadruple,
                Valency              = 4,
                ExactMass            = 12.0,
                Abundance            = 100.0,
                IsAromatic           = true,
                IsInRing             = true,
                Id = "Me"
            };

            hydrogen.AddProperties(new Dictionary <object, object>());
            hydrogen.SetProperties(new Dictionary <object, object>());
            hydrogen.SetProperty("", "");
            hydrogen.RemoveProperty("");
            Assert.IsTrue(true); // to indicate we made it
        }
Ejemplo n.º 3
0
        public void TestExpectedValues()
        {
            IAtom hydrogen = new ImmutableHydrogen();

            Assert.AreEqual("H", hydrogen.Symbol);
            Assert.AreEqual(1, hydrogen.AtomicNumber);
            Assert.AreEqual(1, hydrogen.MassNumber);
        }
Ejemplo n.º 4
0
        public void TestOverwriteStaticValues()
        {
            IAtom hydrogen = new ImmutableHydrogen
            {
                Symbol       = "C",
                AtomicNumber = 12,
                MassNumber   = 13
            };

            Assert.AreEqual("H", hydrogen.Symbol);
            Assert.AreEqual(1, hydrogen.AtomicNumber);
            Assert.AreEqual(1, hydrogen.MassNumber);
        }
Ejemplo n.º 5
0
        public void TestListenerStuff()
        {
            IAtom hydrogen = new ImmutableHydrogen();

            Assert.AreEqual(0, hydrogen.Listeners.Count);
            hydrogen.Listeners.Add(new DummyListenerAdd());
            Assert.AreEqual(0, hydrogen.Listeners.Count);
            hydrogen.Listeners.Remove(new DummyListenerRemove());
            Assert.AreEqual(0, hydrogen.Listeners.Count);
            hydrogen.NotifyChanged();

            Assert.IsFalse(hydrogen.Notification);
            hydrogen.Notification = true;
            Assert.IsFalse(hydrogen.Notification);
        }
Ejemplo n.º 6
0
        public void TestClone()
        {
            IAtom hydrogen = new ImmutableHydrogen();

            Assert.AreEqual(hydrogen, (IAtom)hydrogen.Clone());
        }