Example #1
0
        private DbDataReader CreateReader()
        {
            var factory = new MockProviderFactory();
            var reader  = factory.CreateReader();

            return(reader);
        }
Example #2
0
        public void ExecuteDataSet()
        {
            var adapter = new Mock <DbDataAdapter>();
            var factory = new MockProviderFactory()
            {
                NewDataAdapter = () => adapter.Object
            };

            adapter.Setup(a => a.Fill(It.IsAny <DataSet>()));
            var db = new DBHelper(factory, "cn");

            var command = db.Factory.CreateCommand();

            db.ExecuteDataSet(command);

            adapter.VerifyAll();
        }
Example #3
0
        public void ExecuteDataSet()
        {
            var adapter = new Mock<DbDataAdapter>();
            var factory = new MockProviderFactory() { NewDataAdapter = () => adapter.Object };

            adapter.Setup(a => a.Fill(It.IsAny<DataSet>()));
            var db = new DBHelper(factory, "cn");

            var command = db.Factory.CreateCommand();
            db.ExecuteDataSet(command);

            adapter.VerifyAll();
        }