public void TestDTypes() { // Arrange const string columnName = "column1"; const string columnType = "string"; var mockSchemaProxy = new Mock <IStructTypeProxy>(); var mockFieldProxy = new Mock <IStructFieldProxy>(); var mockStructDataTypeProxy = new Mock <IStructDataTypeProxy>(); var expectedResultDataFrameProxy = new Mock <IDataFrameProxy>().Object; mockDataFrameProxy.Setup(m => m.DropNa(It.IsAny <int?>(), It.IsAny <string[]>())).Returns(expectedResultDataFrameProxy); mockDataFrameProxy.Setup(m => m.GetSchema()).Returns(mockSchemaProxy.Object); mockSchemaProxy.Setup(m => m.GetStructTypeFields()).Returns(new List <IStructFieldProxy> { mockFieldProxy.Object }); mockFieldProxy.Setup(m => m.GetStructFieldName()).Returns(columnName); mockFieldProxy.Setup(m => m.GetStructFieldDataType()).Returns(mockStructDataTypeProxy.Object); mockStructDataTypeProxy.Setup(m => m.GetDataTypeSimpleString()).Returns(columnType); var sc = new SparkContext(null); // Act var originalDataFrame = new DataFrame(mockDataFrameProxy.Object, sc); var actualColumnNameAndDataType = originalDataFrame.DTypes().ToArray(); // Assert Assert.AreEqual(1, actualColumnNameAndDataType.Length); Assert.AreEqual(columnName, actualColumnNameAndDataType[0].Item1); Assert.AreEqual(columnType, actualColumnNameAndDataType[0].Item2); }