Exemplo n.º 1
0
        public void TestMatrixString()
        {
            //Test1
            var bag1 = new object[, ]
            {
                { null, null, null },
                { "", "myparam ", "hello" },
                { null, "val11", "val12" },
                { null, "val21", "val22" },
                { null, "val31", "val32" }
            };
            var myParamArray1 = bag1.ProcessMatrixString("MyParam");

            UnitTestUtils.EqualMatrix(myParamArray1, new[, ] {
                { "val11", "val12" }, { "val21", "val22" }, { "val31", "val32" }
            });

            //Test2
            var bag2 = new object[, ]
            {
                { null, null, null, null },
                { "", "myparam ", "hello", "" },
                { null, "val11", "val12", "" },
                { null, "val21", "val22", "" },
                { null, null, "", "" }
            };
            var myParamArray2 = bag2.ProcessMatrixString("MyParam");

            UnitTestUtils.EqualMatrix(myParamArray2, new[, ] {
                { "val11", "val12" }, { "val21", "val22" }
            });
        }
Exemplo n.º 2
0
        public void TestTimeMatrixDouble()
        {
            //Test1
            var bag1 = new object[, ]
            {
                { null, null, null, null },
                { "", "myparam ", "hello", "toto" },
                { null, "1y", "1.0", 5.0 },
                { null, "02/22/1978", "2.0", "4.0" },
                { null, "10y", "3.0", 1.0 }
            };

            TimeMatrixDatas timeDatas  = bag1.ProcessTimeMatrixDatas("MyParam");
            var             helloDatas = timeDatas.GetColFromLabel("hello");
            var             totoDatas  = timeDatas.GetColFromLabel("toto");

            UnitTestUtils.EqualDoubleArray(helloDatas, new[] { 1.0, 2.0, 3.0 }, DoubleUtils.MachineEpsilon);
            UnitTestUtils.EqualDoubleArray(totoDatas, new[] { 5.0, 4.0, 1.0 }, DoubleUtils.MachineEpsilon);
        }
Exemplo n.º 3
0
        public void TestVectorString()
        {
            //Test1
            var bag1 = new object[, ]
            {
                { null, null, null },
                { "", "myparam ", "hello" },
                { null, "val1", "" },
                { null, "val2", "" },
                { null, "val3", "" }
            };
            var myParamArray1 = bag1.ProcessVectorString("MyParam");

            UnitTestUtils.EqualArrays(myParamArray1, new[] { "val1", "val2", "val3" });

            //Test2
            var bag2 = new object[, ]
            {
                { null, null, null },
                { "", "myparam ", "hello" },
                { null, "val1", "" },
                { null, "val2", "" },
                { null, null, "" }
            };
            var myParamArray2 = bag2.ProcessVectorString("MyParam");

            UnitTestUtils.EqualArrays(myParamArray2, new[] { "val1", "val2" });

            //Test3
            var bag3 = new object[, ]
            {
                { null, null, null },
                { "", "myparam ", "hello" },
                { null, "val1", "" },
                { null, "val2", "" },
                { null, null, "" }
                //{null, ExcelDna.Integration.ExcelEmpty.Value, ""}
            };
            var myParamArray3 = bag3.ProcessVectorString("MyParam");

            UnitTestUtils.EqualArrays(myParamArray3, new[] { "val1", "val2" });

            //Test4
            var bag4 = new object[, ]
            {
                { null, null, null },
                { "", "myparam ", "hello" },
                { null, "val1", "" },
                { null, "val2", "" },
                { null, "", "" }
            };
            var myParamArray4 = bag4.ProcessVectorString("MyParam");

            UnitTestUtils.EqualArrays(myParamArray4, new[] { "val1", "val2" });

            //Test5
            var bag5 = new object[, ]
            {
                { null, null, null },
                { "", "myparam ", "hello" },
                { null, "val1", "" },
                { null, "val2", "" },
                { null, "   ", "" }
            };
            var myParamArray5 = bag5.ProcessVectorString("MyParam");

            UnitTestUtils.EqualArrays(myParamArray5, new[] { "val1", "val2" });
        }