Exemplo n.º 1
0
        public void PublicFunctionsEvalEnvExpressionToArrayTable_Throws()
        {
            //------------Setup for test--------------------------
            var env = CreateEnvironmentWithData();
            var lst = new List <DataStorage.WarewolfAtom>
            {
                DataStorage.WarewolfAtom.Nothing,
                DataStorage.WarewolfAtom.NewPositionedValue(new Tuple <int, DataStorage.WarewolfAtom>(2, DataStorage.WarewolfAtom.NewDataString("a"))),
                DataStorage.WarewolfAtom.NewDataString("A")
            };

            //------------Execute Test---------------------------
            Assert.ThrowsException <Dev2.Common.Common.NullValueInVariableException>(() =>
            {
                var enumerator = PublicFunctions.EvalEnvExpressionToArrayTable("[[NotExistingRec(*)]]", 0, env, true);
                var res        = enumerator.ToArray();
            });
        }
Exemplo n.º 2
0
        public void PublicFunctionsEvalEnvExpressionToArrayTable()
        {
            //------------Setup for test--------------------------
            var env = CreateEnvironmentWithData();
            var lst = new List <DataStorage.WarewolfAtom>
            {
                DataStorage.WarewolfAtom.Nothing,
                DataStorage.WarewolfAtom.NewPositionedValue(new Tuple <int, DataStorage.WarewolfAtom>(2, DataStorage.WarewolfAtom.NewDataString("a"))),
                DataStorage.WarewolfAtom.NewDataString("A")
            };
            //------------Execute Test---------------------------
            var enumerator = PublicFunctions.EvalEnvExpressionToArrayTable("[[Rec(*)]]", 0, env, true);
            var res        = enumerator.ToArray();

            Assert.IsNotNull(res);

            Assert.AreEqual(5, res.Length);

            Assert.AreEqual(2, res[0].Length);
            Assert.AreEqual(2, res[1].Length);
            Assert.AreEqual(2, res[2].Length);
            Assert.AreEqual(2, res[3].Length);

            // column names in first row
            Assert.IsTrue(res[0][0].Equals("a"));
            Assert.IsTrue(res[0][1].Equals("b"));

            // data
            Assert.IsTrue(res[1][0].Equals("1"));
            Assert.IsTrue(res[1][1].Equals("a"));
            Assert.IsTrue(res[2][0].Equals("2"));
            Assert.IsTrue(res[2][1].Equals("b"));
            Assert.IsTrue(res[3][0].Equals("3"));
            Assert.IsTrue(res[3][1].Equals("c"));
            Assert.IsTrue(res[4][0].Equals("2"));
            Assert.IsTrue(res[4][1].Equals("c"));
        }