示例#1
0
        public void TestNumeric()
        {
            var tnumeric = new TNumeric("NUM");

            tnumeric.Set("0,255");
            Assert.AreEqual(0.255f, tnumeric.value);

            tnumeric.Set("");
            Assert.AreEqual(0f, tnumeric.value);

            var tsum = new TNumeric("SUM")
            {
                function = TNumeric.getFuncByString("SUM")
            };

            tsum.Set("0,5");
            tsum.Set("1,5");
            Assert.AreEqual(2f, tsum.value);

            tsum = new TNumeric("WAT")
            {
                function = TNumeric.getFuncByString("Invalid?")
            };
            tsum.Set("0,5");
            tsum.Set("1,5");
            Assert.AreNotEqual(2f, tsum.value);
        }
示例#2
0
        public static Dictionary <string, TVariable> getVariables()
        {
            Dictionary <string, TVariable> data = new Dictionary <string, TVariable>();

            var tvariable = new TVariable("FIO");

            tvariable.Set("Ivanov Ivan Ivanovich");
            data.Add(tvariable.name, tvariable);

            var tnumeric = new TNumeric("SUMMA");

            tnumeric.Set(12.3456f);
            data.Add(tnumeric.name, tnumeric);

            var tdate = new TDate("DATE");

            tdate.Set("22.11.2001");
            data.Add(tdate.name, tdate);

            return(data);
        }