Esempio n. 1
0
        public void CarbonIsotopesTest()
        {
            Dictionary <double, double> cIsotopes = elements.GetElement("c").Isotopes;
            double c12Abundance;
            double c13Abundance;
            double c14Abundance;

            Assert.IsTrue(cIsotopes.TryGetValue(12, out c12Abundance));
            Assert.IsNotNull(c12Abundance);
            Assert.AreEqual(0.988922, c12Abundance);

            Assert.IsTrue(cIsotopes.TryGetValue(13.00335484, out c13Abundance));
            Assert.IsNotNull(c13Abundance);
            Assert.AreEqual(0.011078, c13Abundance);

            Assert.IsFalse(cIsotopes.TryGetValue(14, out c14Abundance));
        }
Esempio n. 2
0
        private static bool GetVertex(CallMethodAction callMethod, out Vertex vertex)
        {
            vertex = null;

            if (callMethod.CallingMethod == ElementList.GetElement <V_Vector>())
            {
                double x = 0, y = 0, z = 0;

                if (callMethod.ParameterValues[0] != null)
                {
                    var num = callMethod.ParameterValues[0] as NumberAction;
                    if (num == null)
                    {
                        return(false);
                    }
                    x = num.Value;
                }
                if (callMethod.ParameterValues[1] != null)
                {
                    var num = callMethod.ParameterValues[1] as NumberAction;
                    if (num == null)
                    {
                        return(false);
                    }
                    y = num.Value;
                }
                if (callMethod.ParameterValues[2] != null)
                {
                    var num = callMethod.ParameterValues[2] as NumberAction;
                    if (num == null)
                    {
                        return(false);
                    }
                    z = num.Value;
                }

                vertex = new Vertex(x, y, z);
                return(true);
            }
            return(false);
        }