public void CopyMapToFrame_ForDoubles(int nodeCount, int edgeCount, double[] vals, bool directed)
        {
            INetworkAdjList srcNetwork = NetGenerator.GenerateAdjList(nodeCount, 0, directed);
            NetGenerator.CreateEdges(srcNetwork, edgeCount);
            AdjListEdgeDataBuilder builder = new AdjListEdgeDataBuilder();

            IEdgeDoubleMap map = builder.SetDoubleValues(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(edgeCount, frame.RowCount, "frame rows should match expected.");

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

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

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

            IAttributeListMgr mgr = ((IEdgeAttributes)net).EdgeAttributeMgr;
            Assert.AreEqual(0, mgr.Count, "mgr.Count should match");
        }
        public void Convert_WithEdgeDataAttributes(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);

            AdjListEdgeDataBuilder dataBuilder = new AdjListEdgeDataBuilder();
            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, "EdgeCount should match");
            Assert.AreEqual<int>(net.Edges.Count, src.EdgeCount, "EdgeCount 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 = ((IEdgeAttributes)net).EdgeAttributeMgr;

            Assert.IsNotNull(mgr, "mgr should not be null");
            Assert.AreEqual(4, mgr.Count, "mgr.Count should match expected");
            Assert.AreEqual(numEdges, 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");
            }
        }