public void ColumnIndex(int rowCount, Type[] colTypes, int targetIndex)
        {
            SimpleFrame table = SimpleFrameGenerator.CreateTable(rowCount, colTypes);
            SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(targetIndex, table);

            int result = ca.ColumnIndex;
            Assert.AreEqual<int>(targetIndex, result, "targetIndex should match expected");
        }
        public void Column(int rowCount, Type[] colTypes, int targetIndex)
        {
            SimpleFrame table = SimpleFrameGenerator.CreateTable(rowCount, colTypes);
            SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(targetIndex, table);

            DataColumn actualColumn = table.Columns[targetIndex];
            DataColumn column = ca.Column;
            Assert.IsNotNull(column);
            Assert.AreSame<DataColumn>(column, actualColumn, "Column ref should match expected");
        }
        public void Contains(string targetVal, int actualIndex)
        {
            string[] vals = new string[] { "x2", "lala", "zzz" };
            SimpleFrame table = SimpleFrameGenerator.CreateTable(vals, "col 0");

            SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(0, table);

            int result = ca.Contains(targetVal);

            Assert.AreEqual<int>(result, actualIndex, "result should match expectedResult.");
        }
        public void CopyTo_Array(int startingIndex, string[] vals)
        {
            SimpleFrame table = SimpleFrameGenerator.CreateTable(vals, "col 0");

            SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(0, table);

            string[] results = new string[vals.Length];
            ca.CopyTo(results, startingIndex);

            Assert.IsNotNull(results, "Results [] is not null");
            Assert.AreEqual(vals.Length, results.Length, "results.Count should match expected");

            for (int i = 0; i < results.Length; i++)
            {
                Assert.AreEqual<string>(results[i], vals[i], "Values matches");
            }
        }
        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 Table(int rowCount, Type[] colTypes, int targetIndex)
        {
            SimpleFrame table = SimpleFrameGenerator.CreateTable(rowCount, colTypes);
            SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(targetIndex, table);

            SimpleFrame resultTable = ca.Table as SimpleFrame;
            Assert.IsNotNull(resultTable);
            Assert.AreSame<SimpleFrame>(resultTable, table, "Table ref should match expected");
        }
        public void SetItem(int rowCount, Type[] colTypes, int targetColIndex, int targetRowIndex, string newValue)
        {
            SimpleFrame table = SimpleFrameGenerator.CreateTable(rowCount, colTypes);
            string actualValue = (string)table.Rows[targetRowIndex][targetColIndex];

            SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(targetColIndex, table);

            string result = ca[targetRowIndex];
            Assert.AreNotEqual<string>(result, newValue, "Pre-test:  values should not match");

            ca[targetRowIndex] = newValue;
            result = ca[targetRowIndex];

            Assert.AreEqual<string>(result, newValue, "Getter result should match expected");
        }
        public void GetEnumerator_of_T(int startingIndex, string[] vals)
        {
            SimpleFrame table = SimpleFrameGenerator.CreateTable(vals, "col 0");

            SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(0, table);

            int ctr = 0;
            foreach (string val in ca)
            {
                Assert.AreEqual<string>(val, vals[ctr++], "Enumerated items match");
            }
        }
        public void GetEnumerator(int startingIndex, string[] vals)
        {
            SimpleFrame table = SimpleFrameGenerator.CreateTable(vals, "col 0");

            SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(0, table);

            System.Collections.IEnumerator ix = (ca as System.Collections.IEnumerable).GetEnumerator();

            int ctr = 0;
            string item;
            while (ix.MoveNext())
            {
                item = (string)ix.Current;
                Assert.AreEqual<string>(item, vals[ctr++], "Enumerrated items match");
            }
        }
 public void Ctor_ThrowsExceptionIfColDateTypeDoesNotMatchT(int rowCount, Type[] colTypes, int targetIndex)
 {
     SimpleFrame table = SimpleFrameGenerator.CreateTable(rowCount, colTypes);
     SimpleFrameColumnAccessor<string> ca = new SimpleFrameColumnAccessor<string>(targetIndex, table);
 }