public void Copy_FrameByRowsAndVerifyValues(int testId, int expectedRowCount, int[] rowIndices, double[] initialValues, double[] expectedVals) { SimpleFrame srcTable = SimpleFrameGenerator.CreateTable(initialValues) as SimpleFrame; Guid id = new Guid(); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); SimpleFrame copy = cp.Copy(srcTable, id, rowIndices) as SimpleFrame; Assert.AreEqual(expectedRowCount, copy.RowCount, "RowCount should match"); Assert.AreEqual(srcTable.ColumnCount, copy.ColumnCount, "ColumnCount should match"); double val; for (int i = 0; i < copy.RowCount; i++) { val = (double)copy.Rows[i][0]; Assert.AreEqual(expectedVals[i], val, "Items[i] should match"); } }
public void Copy_FrameByRowsAndVerifyColumnsAndRowCount(int testId, int expectedRowCount, int[] rowIndices, double[] initialValues) { SimpleFrame srcTable = SimpleFrameGenerator.CreateTable(initialValues) as SimpleFrame; Guid id = new Guid(); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); SimpleFrame copy = cp.Copy(srcTable, id, rowIndices) as SimpleFrame; Assert.AreEqual(expectedRowCount, copy.RowCount, "RowCount should match"); Assert.AreEqual(srcTable.ColumnCount, copy.ColumnCount, "ColumnCount should match"); for (int i = 0; i < srcTable.ColumnCount; i++) { DataColumn srcCol = srcTable.Columns[i]; DataColumn copyCol = copy.Columns[i]; Assert.AreEqual(srcCol.ColumnName, copyCol.ColumnName, "Col names should match"); Assert.AreEqual(srcCol.DataType, copyCol.DataType, "Col DataType should match"); Assert.AreEqual(srcCol.DefaultValue, copyCol.DefaultValue, "Col DefaultValue should match"); } }
public void Copy_ToFrame_AndVerifyColumnsAndRowCount(int srcTableRowCount, int targTableRowCount, int exptectedRowCount) { SimpleFrame srcTable = SimpleFrameGenerator.CreateTableWith5Cols(srcTableRowCount); Type[] colTypes = srcTable.ColumnTypes; SimpleFrame copy = SimpleFrameGenerator.CreateTable(targTableRowCount, colTypes); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); cp.Copy(srcTable, copy); Assert.AreEqual(exptectedRowCount, copy.RowCount, "RowCount should match"); Assert.AreEqual(srcTable.ColumnCount, copy.ColumnCount, "ColumnCount should match"); for (int i = 0; i < srcTable.ColumnCount; i++) { DataColumn srcCol = srcTable.Columns[i]; DataColumn copyCol = copy.Columns[i]; Assert.AreEqual(srcCol.DataType, copyCol.DataType, "Col DataType should match"); } }
public void Copy_WithCopyDataParam_ToNewFrameThrowsIfSrcIsInvalidType() { IFrame src = new BlueSpider.Blob.TestSupport.Data.Dummies.DummyFrame(); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); cp.Copy(src, Guid.NewGuid(), true); }
public void Copy_ByRowIndices_ToNewFrameThrowsIfSrcIsInvalidType() { IFrame src = new BlueSpider.Blob.TestSupport.Data.Dummies.DummyFrame(); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); cp.Copy(src, Guid.NewGuid(), new int[] { }); }
public void Copy_WithCopyDataParam_ToNewFrameTableAndVerifyValues(bool copyData, int rows) { SimpleFrame srcTable = SimpleFrameGenerator.CreateTableWith5Cols(rows); Guid id = new Guid(); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); SimpleFrame copy = cp.Copy(srcTable, id, copyData) as SimpleFrame; object[] srcItems = null; object[] copyItems = null; for (int i = 0; i < srcTable.RowCount; i++) { srcItems = srcTable.Rows[i].ItemArray; copyItems = copy.Rows[i].ItemArray; Assert.AreEqual(srcItems.Length, copyItems.Length, "Items[] length names should match"); for (int j = 0; j < srcItems.Length; j++) { Assert.AreEqual(srcItems[j], copyItems[j], "Items[j] should match"); } } }
public void Copy_WithCopyDataParam_ToNewFrameAndVerifyId(bool copyData) { SimpleFrame srcTable = SimpleFrameGenerator.CreateTableWith5Cols(0); Guid id = new Guid(); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); SimpleFrame copy = cp.Copy(srcTable, id, copyData) as SimpleFrame; Assert.AreEqual(id, copy.Id, "Ids should match"); }
public void Copy_WithCopyDataParam_ToNewFrameAndVerifyColumnsAndRowCount(bool copyData, int rows) { SimpleFrame srcTable = SimpleFrameGenerator.CreateTableWith5Cols(rows); Guid id = new Guid(); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); SimpleFrame copy = cp.Copy(srcTable, id, copyData) as SimpleFrame; Assert.AreEqual(srcTable.RowCount, copy.RowCount, "RowCount should match"); Assert.AreEqual(srcTable.ColumnCount, copy.ColumnCount, "ColumnCount should match"); for (int i = 0; i < srcTable.ColumnCount; i++) { DataColumn srcCol = srcTable.Columns[i]; DataColumn copyCol = copy.Columns[i]; Assert.AreEqual(srcCol.ColumnName, copyCol.ColumnName, "Col names should match"); Assert.AreEqual(srcCol.DataType, copyCol.DataType, "Col DataType should match"); Assert.AreEqual(srcCol.DefaultValue, copyCol.DefaultValue, "Col DefaultValue should match"); } }
public void Copy_ToFrame_ThrowsIfTargIsInvalidType() { SimpleFrame src = SimpleFrameGenerator.CreateTable(0, new Type[] { typeof(bool) }); IFrame copy = new BlueSpider.Blob.TestSupport.Data.Dummies.DummyFrame(); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); cp.Copy(src, copy); }
public void Copy_ToFrame_ThrowsIfSrcAndTargHaveDifferentColTypes() { SimpleFrame src = SimpleFrameGenerator.CreateTable(0, new Type[] { typeof(bool) }); SimpleFrame copy = SimpleFrameGenerator.CreateTable(0, new Type[] { typeof(int) }); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); cp.Copy(src, copy); }
public void Copy_ToFrame_ThrowsIfSrcAndTargAreSame() { SimpleFrame src = SimpleFrameGenerator.CreateTable(0, new Type[] { typeof(bool) }); SimpleFrameDataCopier cp = new SimpleFrameDataCopier(); cp.Copy(src, src); }