예제 #1
0
        public void TestConcatenateAll()
        {
            var d1 = DataMap.FromDictionary(new Dictionary <string, IList>()
            {
                { "foo", new float[] { 1, 2, 3, 4, 5 } },
                { "bar", new string[] { "a", "b", "c", "d", "e" } },
            });

            var d2 = DataMap.FromDictionary(new Dictionary <string, IList>()
            {
                { "bar", new string[] { "x", "y", "z" } },
                { "baz", new bool[] { true, false, false } }
            });

            var result = DataMap.ConcatenateAll(d1, d2);

            Assert.Equal(5, result.RowCount);
            Assert.Equal(new string[] { "foo", "bar", "bar_1", "baz" }, result.ColumnNames.ToArray());

            var c1 = result.GetAs <float>("foo");

            Assert.Equal(new float[] { 1, 2, 3, 4, 5 }, c1);

            var c2 = result.GetAs <string>("bar");

            Assert.Equal(new string[] { "a", "b", "c", "d", "e" }, c2);

            var c3 = result.GetAs <string>("bar_1");

            Assert.Equal(new string[] { "x", "y", "z" }, c3);

            var c4 = result.GetAs <bool>("baz");

            Assert.Equal(new bool[] { true, false, false }, c4);
        }