public void Constructor()
        {
            IParameterFactory   parameterFactory   = new SqlServerParameterFactory();
            IDataAdapterFactory dataAdapterFactory = new SqlServerDataAdapterFactory();
            IConnectionFactory  connectionFactory  = new SqlServerConnectionFactory();

            using (var connection = connectionFactory.Open(AppState.ConnectionString))
                using (var reader = new SqlReader(connection, parameterFactory, dataAdapterFactory))
                {
                    Assert.IsNotNull(reader);
                }
        }
        public void Read_Count()
        {
            IParameterFactory   parameterFactory   = new SqlServerParameterFactory();
            IDataAdapterFactory dataAdapterFactory = new SqlServerDataAdapterFactory();
            IConnectionFactory  connectionFactory  = new SqlServerConnectionFactory();

            using (var connection = connectionFactory.Open(AppState.ConnectionString))
                using (var reader = new SqlReader(connection, parameterFactory, dataAdapterFactory))
                {
                    var dataSet = reader.Read("select count(*) from Test.Test");
                    Assert.IsNotNull(dataSet);
                    Assert.AreEqual(1, dataSet.Tables.Count);
                    Assert.IsTrue(dataSet.Tables[0].Rows.Count > 0);
                }
        }
        public void Read_WithParams()
        {
            IParameterFactory   parameterFactory   = new SqlServerParameterFactory();
            IDataAdapterFactory dataAdapterFactory = new SqlServerDataAdapterFactory();
            IConnectionFactory  connectionFactory  = new SqlServerConnectionFactory();

            using (var connection = connectionFactory.Open(AppState.ConnectionString))
                using (var reader = new SqlReader(connection, parameterFactory, dataAdapterFactory))
                {
                    var dataSet = reader.Read("select * from Test.Test where Status=@Status", new Dictionary <string, object> {
                        ["Status"] = 1
                    });
                    Assert.IsNotNull(dataSet);
                    Assert.AreEqual(1, dataSet.Tables.Count);
                    Assert.AreEqual(1, dataSet.Tables[0].Rows.Count);
                }
        }
        public void Read_ToArray()
        {
            IParameterFactory   parameterFactory   = new SqlServerParameterFactory();
            IDataAdapterFactory dataAdapterFactory = new SqlServerDataAdapterFactory();
            IConnectionFactory  connectionFactory  = new SqlServerConnectionFactory();

            using (var connection = connectionFactory.Open(AppState.ConnectionString))
                using (var reader = new SqlReader(connection, parameterFactory, dataAdapterFactory))
                {
                    //var x = new int[] { 1, 2 };
                    //var dataSet = reader.Read($"select * from Test where Id in ({System.String.Join(",", x)})");
                    var dataSet = reader.Read("select * from Test.Test");

                    Assert.IsNotNull(dataSet);
                    Assert.AreEqual(1, dataSet.Tables.Count);
                    Assert.IsTrue(dataSet.Tables[0].Rows.Count > 0);

                    var records = dataSet.Tables[0].Rows.ToArray <Test>();
                    Assert.IsNotNull(records);
                    Assert.IsTrue(records.Length > 0);
                }
        }