public void TestColumns() { var requestsSchema = new StructType(new List <StructField> { new StructField("test", new StringType(), false), }); var x = requestsSchema.JsonValue.ToString(); Mock <IStructTypeProxy> mockStructTypeProxy = new Mock <IStructTypeProxy>(); mockStructTypeProxy.Setup(m => m.ToJson()).Returns(x); Mock <IStructFieldProxy> mockStructFieldProxy = new Mock <IStructFieldProxy>(); mockStructFieldProxy.Setup(m => m.GetStructFieldName()).Returns("testcol"); mockStructTypeProxy.Setup(m => m.GetStructTypeFields()) .Returns(new List <IStructFieldProxy>() { mockStructFieldProxy.Object }); Mock <IDataFrameProxy> mockDataFrameProxy = new Mock <IDataFrameProxy>(); mockDataFrameProxy.Setup(m => m.GetSchema()).Returns(mockStructTypeProxy.Object); mockDatasetProxy.Setup(m => m.ToDF()).Returns(mockDataFrameProxy.Object); var dataset = new Dataset(mockDatasetProxy.Object); var columns = dataset.Columns(); Assert.AreEqual(1, columns.Count()); Assert.AreEqual("testcol", columns.First()); }