示例#1
0
        public void TestJdbc2()
        {
            // arrange
            mockDataFrameReaderProxy.Setup(m => m.Jdbc(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                                                       It.IsAny <string>(), It.IsAny <int>(), It.IsAny <Dictionary <string, string> >()));
            var dataFrameReader = new DataFrameReader(mockDataFrameReaderProxy.Object, sparkContext);

            // Act
            const string url                  = "url";
            const string table                = "table_name";
            const string columnName           = "col1";
            const string lowerBound           = "a";
            const string upperBound           = "z";
            const int    numPartitions        = 5;
            var          connectionProperties = new Dictionary <string, string>()
            {
                { "prop1", "value1" },
                { "prop2", "value2" }
            };

            dataFrameReader.Jdbc(url, table, columnName, lowerBound, upperBound, numPartitions, connectionProperties);

            // Assert
            mockDataFrameReaderProxy.Verify(m => m.Jdbc(url, table, columnName, lowerBound, upperBound, numPartitions, connectionProperties),
                                            Times.Once);
        }
示例#2
0
        public void TestJdbc1()
        {
            // arrange
            mockDataFrameReaderProxy.Setup(m => m.Jdbc(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Dictionary <string, string> >()));
            var dataFrameReader = new DataFrameReader(mockDataFrameReaderProxy.Object, sparkContext);

            // Act
            const string url        = "url";
            const string table      = "table_name";
            var          properties = new Dictionary <string, string>()
            {
                { "prop1", "value1" },
                { "prop2", "value2" }
            };

            dataFrameReader.Jdbc(url, table, properties);

            // Assert
            mockDataFrameReaderProxy.Verify(m => m.Jdbc(url, table, properties), Times.Once);
        }