public void CopyMapToFrame_ForInts(int[] vals, bool directed)
        {
            int nodeCount = vals.Length;
            INetworkAdjList srcNetwork = NetGenerator.GenerateAdjList(nodeCount, 0, directed);
            AdjListNodeDataBuilder builder = new AdjListNodeDataBuilder();

            INodeIntMap map = builder.SetIntValues(srcNetwork, 0, vals);

            SimpleFrameFactory fFac = new SimpleFrameFactory();
            SimpleFrame frame = fFac.Create(Guid.NewGuid()) as SimpleFrame;

            _Ingester.CopyMapToFrame(srcNetwork, map, frame);

            Assert.AreEqual(1, frame.ColumnCount, "frame column count should match expected.");
            Assert.AreEqual(nodeCount, frame.RowCount, "frame rows should match expected.");

            for (int i = 0; i < vals.Length; i++)
            {
                Assert.AreEqual(vals[i], frame.Rows[i][0], "Values should match");
            }
        }
        public void Convert_WithNodeDataAttributes_WhenIncludeNodeDataIsFalse(int numNodes, int numEdges, bool isDirected, int[] intVals, double[] doubleVals, bool[] boolVals, string[] stringVals)
        {
            INetworkAdjList src = NetGenerator.GenerateAdjList(numNodes, numEdges, isDirected);

            AdjListNodeDataBuilder dataBuilder = new AdjListNodeDataBuilder();
            dataBuilder.SetIntValues(src, 0, intVals);
            dataBuilder.SetDoubleValues(src, 1, doubleVals);
            dataBuilder.SetBoolValues(src, 2, boolVals);
            dataBuilder.SetStringValues(src, 3, stringVals);

            _Converter.IncludeNodeData = false;
            ISimpleAdjList net = (ISimpleAdjList)_Converter.Convert(src);

            IAttributeListMgr mgr = ((INodeAttributes)net).NodeAttributeMgr;
            Assert.AreEqual(0, mgr.Count, "mgr.Count should match");
        }
        public void Convert_WithNodeDataAttributes(int testId, int numNodes, int numEdges, bool isDirected, bool selfLoops, bool multiEdges, int[] intVals, double[] doubleVals, bool[] boolVals, string[] stringVals)
        {
            INetworkAdjList src = NetGenerator.GenerateAdjList(numNodes, numEdges, isDirected, selfLoops, true, multiEdges);

            AdjListNodeDataBuilder dataBuilder = new AdjListNodeDataBuilder();
            dataBuilder.SetIntValues(src, 0, intVals);
            dataBuilder.SetDoubleValues(src, 1, doubleVals);
            dataBuilder.SetBoolValues(src, 2, boolVals);
            dataBuilder.SetStringValues(src, 3, stringVals);

            ISimpleAdjList net = (ISimpleAdjList)_Converter.Convert(src);

            Assert.IsNotNull(net, "net should not be null");
            Assert.AreEqual<int>(net.NodeCount, src.NodeCount, "Nodecount should match");
            Assert.AreEqual<int>(net.Nodes.Count, src.NodeCount, "Nodecount should match");
            Assert.AreEqual<int>(net.EdgeCount, src.EdgeCount, "Nodecount should match");
            Assert.AreEqual<int>(net.Edges.Count, src.EdgeCount, "Nodecount should match");
            Assert.AreEqual<bool>(net.IsDirected, src.IsDirected, "IsDirected should match");
            Assert.AreEqual<string>(net.Name, src.Name, "Name should match");
            Assert.AreNotEqual<Guid>(net.Id, src.Id, "Id should not match");

            IAttributeListMgr mgr = ((INodeAttributes)net).NodeAttributeMgr;

            Assert.IsNotNull(mgr, "mgr should not be null");
            Assert.AreEqual(4, mgr.Count, "mgr.Count should match expected");
            Assert.AreEqual(numNodes, mgr.Capacity, "mgr.Capacity should match expected");

            //--
            IAttributeList list = mgr[0];
            Assert.IsNotNull(list, "list should not be null");
            Assert.AreEqual(typeof(int), list.DataType, "list.DataType should match expected");
            string intColName = list.Name;

            //--
            list = mgr[1];
            Assert.IsNotNull(list, "list should not be null");
            Assert.AreEqual(typeof(double), list.DataType, "list.DataType should match expected");
            string doubleColName = list.Name;

            //--
            list = mgr[2];
            Assert.IsNotNull(list, "list should not be null");
            Assert.AreEqual(typeof(bool), list.DataType, "list.DataType should match expected");
            string boolColName = list.Name;

            //--
            list = mgr[3];
            Assert.IsNotNull(list, "list should not be null");
            Assert.AreEqual(typeof(string), list.DataType, "list.DataType should match expected");
            string stringColName = list.Name;

            object objVal = null;

            //-- ints
            list = mgr[0];
            int intVal = -1;
            for (int i = 0; i < list.Count; i++)
            {
                objVal = list[i];
                Assert.IsNotNull(objVal, "objVal should not be null");
                Assert.IsInstanceOfType(typeof(int), objVal, "objVal should match expected type");
                intVal = (int)objVal;
                Assert.AreEqual(intVals[i], intVal, "val should match expected");
            }

            //-- doubles
            list = mgr[1];
            double doubleVal = -1.1;
            for (int i = 0; i < list.Count; i++)
            {
                objVal = list[i];
                Assert.IsNotNull(objVal, "objVal should not be null");
                Assert.IsInstanceOfType(typeof(double), objVal, "objVal should match expected type");
                doubleVal = (double)objVal;
                Assert.AreEqual(doubleVals[i], doubleVal, "val should match expected");
            }

            //-- bools
            list = mgr[2];
            bool boolVal = false;
            for (int i = 0; i < list.Count; i++)
            {
                objVal = list[i];
                Assert.IsNotNull(objVal, "objVal should not be null");
                Assert.IsInstanceOfType(typeof(bool), objVal, "objVal should match expected type");
                boolVal = (bool)objVal;
                Assert.AreEqual(boolVals[i], boolVal, "val should match expected");
            }

            //-- strings
            list = mgr[3];
            string stringVal = null;
            for (int i = 0; i < list.Count; i++)
            {
                objVal = list[i];
                Assert.IsNotNull(objVal, "objVal should not be null");
                Assert.IsInstanceOfType(typeof(string), objVal, "objVal should match expected type");
                stringVal = (string)objVal;
                Assert.AreEqual(stringVals[i], stringVal, "val should match expected");
            }
        }